WordPress filter hook · part of WordPress core
document_title
A WordPress core filter that 6 plugins also fire themselves, running on 2,040+ sites between them.
“Filter the document title from the post.”
How to use document_title
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'document_title', function( $title ) {
// Change $title here.
return $title;
}, 10, 1 );Argument names come from WP Document Revisions's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
6 plugins that fire document_title
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WP Document Revisions2,000+ installs
apply_filters( 'document_title', $title )includes/trait-wp-document-revisions-query.php:380 -
MCP Connector for wp2ai20+ installs
apply_filters( 'document_title', $title )includes/class-wp2ai-rest-api.php:15558 -
SlugMaster20+ installs
apply_filters( 'document_title', implode( " {$sep} ", array_filter( $parts ) ) )includes/class-router.php:437 -
TONKATSU (Template-Oriented No-database Knowledge-graph & Tag Setup Utility)Fewer than 10 installs
apply_filters( 'document_title', $title )src/Init/Head.php:191 -
Inklura SEOFewer than 10 installs
apply_filters( 'document_title', Options::format_title_paged( '%title%', $custom, $sitename, $this->separator(), $tagline, $page, $this->page_word() ) )src/Frontend.php:90 -
Digispot AIFewer than 10 installs
apply_filters( 'document_title', $title )includes/audit/class-preview-source.php:545
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.