Title: document_title_parts
Published: December 9, 2015
Last modified: February 24, 2026

---

# apply_filters( ‘document_title_parts’, array $title )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#wp--skip-link--target)

Filters the parts of the document title.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#parameters)󠁿

 `$title`array

The document title parts.

 * `title` string
 * Title of the viewed page.
 * `page` string
 * Optional. Page number if paginated.
 * `tagline` string
 * Optional. Site description when on home page.
 * `site` string
 * Optional. Site title when not on home page.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#source)󠁿

    ```php
    $title = apply_filters( 'document_title_parts', $title );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/general-template.php#L1283)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L1283-L1283)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_get_document_title()](https://developer.wordpress.org/reference/functions/wp_get_document_title/)`wp-includes/general-template.php` |

Returns document title for the current page.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#comment-content-3371)
 2.    [Dave Navarro, Jr.](https://profiles.wordpress.org/dnavarrojr/)  [  7 years ago  ](https://developer.wordpress.org/reference/hooks/document_title_parts/#comment-3371)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F%23comment-3371)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F%23comment-3371)
 4.  Change the title for a specific page ID:
 5.      ```php
         add_filter( 'document_title_parts', function( $title_parts_array ) {
             if ( get_the_ID() == 2055 ) {
                 $title_parts_array['title'] = 'Custom Page Title';
             }
             return $title_parts_array;
         } );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F%3Freplytocom%3D3371%23feedback-editor-3371)
 7.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/document_title_parts/?output_format=md#comment-content-2886)
 8.    [coreytrice](https://profiles.wordpress.org/coreytrice/)  [  8 years ago  ](https://developer.wordpress.org/reference/hooks/document_title_parts/#comment-2886)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F%23comment-2886)
     Vote results for this note: -2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F%23comment-2886)
 10. Make sure your **[add_filter()](https://developer.wordpress.org/reference/functions/add_filter/)**
     comes before the **[get_header()](https://developer.wordpress.org/reference/functions/get_header/)**
     in your template file if you adding a title filter for that template file.
 11.     ```php
         <?php
     
         // This filter must be above get_header() to work correctly
         add_filter('document_title_parts', 'callbackFunctionName');
     
         get_header();
     
         ...
         ```
     
 12.  * It’s bad practice to do `add_filter` in your template file. These kind of calls
        should live in your theme’s `functions.php` file instead.
      * [infostreams](https://profiles.wordpress.org/infostreams/) [7 years ago](https://developer.wordpress.org/reference/hooks/document_title_parts/#comment-2970)
 13.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F%3Freplytocom%3D2886%23feedback-editor-2886)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fdocument_title_parts%2F)
before being able to contribute a note or feedback.