SEO

This tag groups every hook that has a direct line to how a page is represented in <strong>search results</strong> - from <a href="https://4wp.dev/hooks/filters/document_title_parts/">document_title_parts</a> and <a href="https://4wp.dev/hooks/filters/wp_title/">wp_title</a> shaping the page title, to rest_prepare_post controlling what a headless frontend exposes.Get one of these wrong and nothing crashes — the page just quietly ranks worse, or shows the wrong title in a search snippet.Reviewing this exact set of hooks is standard practice in a technical SEO audit, and it's the kind of detail an experienced WordPress developer checks first when a client's rankings drop for no obvious reason. 0 actions, 2 filters in this tag.

wp_title

head-meta

Filters the document <title> tag

wp_title is the classic document-title filter. Modern themes should prefer document_title_parts — this hook remains for older title tags.

Signature

apply_filters( 'wp_title', string $title, string $sep, string $seplocation );

Example

add_filter( 'wp_title', function( $title, $sep ) {
    return $title . $sep . get_bloginfo( 'name' );
}, 10, 2 );

Common Use Cases

  • Customize SEO page titles on legacy themes
  • Append site name to titles
  • Set title format for specific pages
  • Override title for 404 pages
since 0.71wp-includes/general-template.php

document_title_parts

head-meta

Filters the parts that build the <title> tag on modern themes

document_title_parts is the modern replacement for wp_title — it works with an array of parts, not a raw string, so you edit pieces instead of parsing text.

Signature

apply_filters( 'document_title_parts', array $title );

Example

add_filter( 'document_title_parts', function( $title ) {
    if ( is_singular( 'book' ) ) {
        $title['title'] .= ' | Book Review';
    }
    return $title;
} );

Common Use Cases

  • Customize SEO page titles per post type
  • Remove the tagline/site name segment
  • Add dynamic segments (category, search term)
  • Override the title on 404 pages
since 4.4.0wp-includes/general-template.php