Filters the parts of the document title.
Parameters
$titlearray- The document title parts.
titlestringTitle of the viewed page.pagestringOptional. Page number if paginated.taglinestringOptional. Site description when on home page.sitestringOptional. Site title when not on home page.
Source
$title = apply_filters( 'document_title_parts', $title );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
Change the title for a specific page ID:
Make sure your add_filter() comes before the get_header() in your template file if you adding a title filter for that template file.
add_filterin your template file. These kind of calls should live in your theme’sfunctions.phpfile instead.