Title: wp_title
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘wp_title’, string $title, string $sep, string $seplocation )

## In this article

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

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

Filters the text of the page title.

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

 `$title`string

Page title.

`$sep`string

Title separator.

`$seplocation`string

Location of the separator (either `'left'` or `'right'`).

## 󠀁[More Information](https://developer.wordpress.org/reference/hooks/wp_title/?output_format=md#more-information)󠁿

The `wp_title` filter is used to filter the title of the page (called with `[wp_title()](https://developer.wordpress.org/reference/functions/wp_title/)`).
This filters the text appearing in the HTML <title> tag (sometimes called the “title
tag” or “meta title”), not the post, page, or category title.

A plugin (or theme) can register as a content filter with the code:

    ```php
    add_filter( 'wp_title', 'filter_function_name', 10, 3 );
    ```

Where ‘filter_function_name’ is the function WordPress should call when the content
is being retrieved. Note that the filter function **must** return the content after
it is finished processing, or the title will be blank and other plugins also filtering
the content may generate errors.

**filter_function_name** should be unique function name. It cannot match any other
function name already declared.

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

    ```php
    $title = apply_filters( 'wp_title', $title, $sep, $seplocation );
    ```

[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#L1464)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L1464-L1464)

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

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

Displays or retrieves page title for all areas of blog.

  |

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

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

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

 1.   [Skip to note 5 content](https://developer.wordpress.org/reference/hooks/wp_title/?output_format=md#comment-content-1076)
 2.    [Andrew Klimek](https://profiles.wordpress.org/andrewklimek/)  [  10 years ago  ](https://developer.wordpress.org/reference/hooks/wp_title/#comment-1076)
 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%2Fwp_title%2F%23comment-1076)
     Vote results for this note: 7[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%2Fwp_title%2F%23comment-1076)
 4.  wp_title is being deprecated, see [https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/](https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/)
 5.  Please use:
 6.   [`pre_get_document_title`](https://developer.wordpress.org/reference/hooks/pre_get_document_title/)–
     short-circuits `wp_get_document_title()` if it returns anything other than an 
     empty value.
      [`document_title_separator`](https://developer.wordpress.org/reference/hooks/document_title_separator/)–
     filters the separator between title parts. [`document_title_parts`](https://developer.wordpress.org/reference/hooks/document_title_parts/)–
     filters the parts that make up the document title, passed in an associative array.
 7.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_title%2F%3Freplytocom%3D1076%23feedback-editor-1076)
 8.   [Skip to note 6 content](https://developer.wordpress.org/reference/hooks/wp_title/?output_format=md#comment-content-2382)
 9.    [acuvic](https://profiles.wordpress.org/acuvic/)  [  9 years ago  ](https://developer.wordpress.org/reference/hooks/wp_title/#comment-2382)
 10. [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%2Fwp_title%2F%23comment-2382)
     Vote results for this note: 6[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%2Fwp_title%2F%23comment-2382)
 11. Just for information, wp_title has been reinstated:
      “_UPDATE 12 November – wp\
     _title has been reinstated until alternative usages have been identified and a
     path forward for them defined._”
 12. Reference link as originally given by Andrew Klimek above [https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/](https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/)
 13.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_title%2F%3Freplytocom%3D2382%23feedback-editor-2382)
 14.  [Skip to note 7 content](https://developer.wordpress.org/reference/hooks/wp_title/?output_format=md#comment-content-907)
 15.   [Drew Jaynes](https://profiles.wordpress.org/DrewAPicture)  [  10 years ago  ](https://developer.wordpress.org/reference/hooks/wp_title/#comment-907)
 16. [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%2Fwp_title%2F%23comment-907)
     Vote results for this note: 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%2Fwp_title%2F%23comment-907)
 17. **Basic Example**
 18. _In header.php:_
 19.     ```php
         <title><?php wp_title('|', true, 'right'); ?></title>
         ```
     
 20. _In functions.php:_
 21.     ```php
         /**
          * Creates a nicely formatted and more specific title element text
          * for output in head of document, based on current view.
          *
          * @param string $title Default title text for current view.
          * @param string $sep   Optional separator.
          * @return string Filtered title.
          */
         function wpdocs_filter_wp_title( $title, $sep ) {
         	global $paged, $page;
     
         	if ( is_feed() )
         		return $title;
     
         	// Add the site name.
         	$title .= get_bloginfo( 'name' );
     
         	// Add the site description for the home/front page.
         	$site_description = get_bloginfo( 'description', 'display' );
         	if ( $site_description && ( is_home() || is_front_page() ) )
         		$title = "$title $sep $site_description";
     
         	// Add a page number if necessary.
         	if ( $paged >= 2 || $page >= 2 )
         		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) );
     
         	return $title;
         }
         add_filter( 'wp_title', 'wpdocs_filter_wp_title', 10, 2 );
         ```
     
 22.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_title%2F%3Freplytocom%3D907%23feedback-editor-907)
 23.  [Skip to note 8 content](https://developer.wordpress.org/reference/hooks/wp_title/?output_format=md#comment-content-6494)
 24.   [Rafa Carvalhido](https://profiles.wordpress.org/rafacarvalhido/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/wp_title/#comment-6494)
 25. [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%2Fwp_title%2F%23comment-6494)
     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%2Fwp_title%2F%23comment-6494)
 26. Example updated with the third parameter of the filter:
 27.     ```php
         add_filter( 'wp_title', 'filter_function_name', 10, 3 );
     
         function filter_function_name( $title, $sep, $seplocation ) {
         	// the magic
         	return $title;
         }
         ```
     
 28.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_title%2F%3Freplytocom%3D6494%23feedback-editor-6494)

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