Site logo

[Support request] How to Remove Site Name from Search Results on Posts

Home Forums Support [Support request] How to Remove Site Name from Search Results on Posts

Home Forums Support How to Remove Site Name from Search Results on Posts

  • This topic has 2 replies, 2 voices, and was last updated 5 years ago by Martin.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1713678
    Martin

    Hi,

    Can you please explain how to remove the website name from Google search results. This is for blog posts. By the way I thought of leaving the site title blank in the customizer but my homepage then shows a blank title tag (using elements for the home page).

    So on Google:

    This is the title of my Blog Post – Site Name <<< Remove this bit please.

    I’m not using any SEO plugin as I don’t like using them.

    I’m using the GP Premium marketing theme.

    Thanks!

    #1713829
    David
    Staff
    Customer Support

    Hi there,

    you can use this PHP Snippet:

    add_filter( 'document_title_parts', function( $title ) {
    
      unset( $title['site'] ); 
    
      return $title;
    
    }, 10, 1 );

    How to add PHP: https://docs.generatepress.com/article/adding-php/

    #1713841
    Martin

    Thanks David – works a treat.

    I created a plugin and placed the code inside.

    Is there a way for this to be only active on blog posts and leave pages left alone?

    Thanks.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.