Site logo

[Support request] Site Title Added To Posts – How Do I Stop It?

Home Forums Support [Support request] Site Title Added To Posts – How Do I Stop It?

Home Forums Support Site Title Added To Posts – How Do I Stop It?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #2184659
    steven

    Hey!

    I’ve noticed on quite a few of my posts that the site title is appended to my post titles. This is screwing up the SEO on these posts and I would like to stop it.

    I’m not using YOAST Seo. I do use a meta title plugin – but that doesn’t seem to help. Google reads the title tag (that the theme displays from the WordPress post) and displays that – but with the site title appended. It won’t read the meta title from the meta plugin. (I use the plugin to specify the meta description, which sometimes works)

    Is there any way to stop the generate press theme from appending the site title to post titles.

    (I have examples. I tried to change them this morning but even if I change the post title, it keeps adding the site title after)

    #2184790
    David
    Staff
    Customer Support

    Hi there,

    where are you seeing this ? Can you share a link so I can see it ?

    #2184800
    steven

    Check my site title VS title on view page source

    Look at the actual title I want

    EDIT: The link to view page source is blocked. If you view the page source, and search for title, you will see that it’s added my site title to the end.

    Another one.

    There are lots of them.

    #2184831
    David
    Staff
    Customer Support

    Try adding this PHP Snippet:

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

    Sorry David, I note you actually mentioned this before on one of my previous topics but I fixed the problem myself so I didn’t see it.

    Could you just refresh my memory where and how to add the snippet? I will bookmark the answer this time!

    #2184835
    David
    Staff
    Customer Support

    No probs – this doc explains how to add PHP:

    https://docs.generatepress.com/article/adding-php/

    TLDR: If you have a Child Theme installed: add the code to the functions.php, if you do not then install the Code Snippets plugin, add a new Snippet and add the code there.

    #2184955
    steven

    I installed and activated it. Added the snippet and activated it.

    Didn’t work.

    Pages still append site title.

    #2184957
    David
    Staff
    Customer Support

    Do you still have that other plugin installed ? If so disable that, and then clear any plugin/server caches.
    To note; I tested the snippet on a clean GP install and it does still work, so we need to eliminate whats interfering with it.

    #2185262
    steven

    I uninstalled the meta titles plugin and sure enough, the problem has gone.

    I prefer to use 0 plugins to be honest, so the less the better. But I would really like to write my own meta descriptions.

    However this is more important so happy to move on from this one..There are unfortunately other problems I’m having which I hope I can get some guidance on.

    Thanks very much for your help!

    #2185263
    David
    Staff
    Customer Support

    You could try changing the snippet i provided to:

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

    The only change is increasing the priority 10 to 999 – this just means the code get fired later, maybe after whatever that plugin is doing. As long as the plugin isn’t hijacking that filter it should work…

    #2185289
    steven

    I’ve unstalled the plugin and it works.

    I’d rather have less plugins anyway.

    Thanks man.

    #2185301
    David
    Staff
    Customer Support

    OK glad to be of help!

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