How to remove blog title from post titles


Hi Venkatesh,

The document title is handled on WordPress core in the wp_get_document_title() (see documentation here) since WordPress version 4.4. So to remove your site title as you requested, you could use WordPress core document_title_parts. Here is an example snippet you may add to your child theme functions.php:

add_filter( 'document_title_parts', 'example_wp_title' );

function example_wp_title( $parts ) {

  // Remove the site name from the document title.
  unset( $parts['site'] );

  return $parts;

}

Happy coding,


Thanks alot Thierry Muller. Perfect 🙂

Write a reply

Login or register to write a reply, it's free!