Change the dash between the page and site name in browser tabs and search results, and drop the tagline from the homepage title.
// "Page title | Site name" instead of "Page title – Site name".
add_filter( 'document_title_separator', fn () => '|' );
// Remove the tagline from the homepage title.
add_filter( 'document_title_parts', function ( array $parts ): array {
unset( $parts['tagline'] );
return $parts;
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
WordPress builds each page’s <title> as “Page – Site” and adds the tagline on the homepage. These two filters let you change the separator and choose which parts appear.
document_title_separator sets the character between parts. document_title_parts receives the parts as an array with keys title, page (for paginated pages), tagline and site. Removing the tagline gives a shorter homepage title.
add_theme_support( 'title-tag' ), which nearly all themes do.Check your browser tab on a post. It should read “Post title | Site name”.