Filter the text of the page title.
Source file: wp-includes/general-template.php
(string) Page title.
(string) Title separator.
(string) Location of the separator (left or right).
wp_title filter is used to filter the title of the page (called with
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:
add_filter( 'wp_title', 'filter_function_name', 10, 2 );
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.
- wp-includes/general-template.php: wp_title()
- Since: WordPress 2.0.0