- This topic has 11 replies, 2 voices, and was last updated 3 years, 11 months ago by
David.
-
AuthorPosts
-
April 11, 2022 at 1:14 am #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)
April 11, 2022 at 4:18 am #2184790David
StaffCustomer SupportHi there,
where are you seeing this ? Can you share a link so I can see it ?
April 11, 2022 at 4:29 am #2184800steven
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.
There are lots of them.
April 11, 2022 at 4:57 am #2184831David
StaffCustomer SupportTry adding this PHP Snippet:
add_filter( 'document_title_parts', function( $title ) { unset( $title['site'] ); return $title; }, 10, 1 );April 11, 2022 at 4:59 am #2184832steven
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!
April 11, 2022 at 5:03 am #2184835David
StaffCustomer SupportNo 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.
April 11, 2022 at 7:44 am #2184955steven
I installed and activated it. Added the snippet and activated it.
Didn’t work.
Pages still append site title.
April 11, 2022 at 7:48 am #2184957David
StaffCustomer SupportDo 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.April 11, 2022 at 9:19 am #2185262steven
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!
April 11, 2022 at 9:24 am #2185263David
StaffCustomer SupportYou 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
10to999– 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…April 11, 2022 at 9:43 am #2185289steven
I’ve unstalled the plugin and it works.
I’d rather have less plugins anyway.
Thanks man.
April 11, 2022 at 9:55 am #2185301David
StaffCustomer SupportOK glad to be of help!
-
AuthorPosts
- You must be logged in to reply to this topic.