How can I remove the sitename or homepage title from all page titles?

By default WordPress use _wp_render_title_tag to hook wp_head ( see here )

add_action( 'wp_head', '_wp_render_title_tag', 1 );

This function is wrapper of wp_get_document_title to show title tag on theme if add_theme_support( 'title-tag' ); added in theme file functions.php ( commonly ).
https://core.trac.wordpress.org/browser/tags/4.4.2/src/wp-includes/general-template.php#L944

If you see filter document_title_parts on function wp_get_document_title(), we can filter parameters that used in title ( title, page, tagline, site ).

Let say if we need to remove site name title part of homepage and single post, you just need to unset parameter title and site with conditional tags, here the sample code ( add in functions.php theme file ):

add_filter( 'document_title_parts', function( $title )
{
    if ( is_home() || is_front_page() )
        unset( $title['title'] ); /** Remove title name */

    if ( is_single() )
        unset( $title['site'] ); /** Remove site name */

    return $title;

}, 10, 1 );

About your issue in Google indexing, it’s off-topic here.

Leave a Comment