apply_filters( 'wp_title', string $title, string $sep, string $seplocation )
Filters the text of the page title.
Parameters
- $title
-
(string) Page title.
- $sep
-
(string) Title separator.
- $seplocation
-
(string) Location of the separator ('left' or 'right').
More Information
The 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.
Source
Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_title