How to Remove Site Name from WordPress Post Title Tags

This is how you can easily remove the name of your website or blog, from the <title> tag of your WordPress site, without the use of any plugins.

Fix WP Title Tag

While this depends on the WordPress theme used, often the title format of WordPress posts seen by Google and other search engines is something like this;

<title>Post Name - Site Name</title>

or it could be;

<title>Post Name | Site Name</title>

If you want to just have the name of the post included and remove the site name, while keeping the old title formatting on homepage and other pages.

Try to add this piece of code to your functions.php file;

add_filter( 'document_title_parts', function( $title )
{
if ( is_single() )
unset( $title['site'] ); /** Remove site name from post titles */
return $title;
}, 10, 1 );

And that’s it. Please note however that;

  • This might not work for all WordPress themes.
  • Google might still append the site name on your titles without your wish, especially if the post title is short.
  • It can take a long time for the title to change for old search results.

Hope that helps.

Did that work for your, or have any questions?
Please, let me know in the comments.

Thanks for reading, David.

Caring is sharing.. thank you! -David

Twitter Button Facebook Button Google Button LinkedIn Button

Write a Comment

Comment