Site logo

Archived topic

Google taking comment date rather than using schema

5 replies · Started by Alex on May 19, 2021

Viewing posts 1–6 of 6

Hello, I recently switched over another site to GP. Pretty much everything went smoothly, except I've noticed Google is now pulling the first comment date on a page as the date it was published/updated, even though the correct date is provided in the page schema. This is causing all my posts to display older dates in the SERPs, which isn't good for CTR.

Looking at the HTML, I can see that this is because the comment date is wrapped with:

<time datetime="2018-08-21T09:13:47+00:00" itemprop="datePublished"

Is there any way to remove the date from comments to prevent this from happening?

Thanks

OK, thanks for the help Elvin. I'll give it a go.

No problem. Let us know if you need further help.

I managed to get this working, so just in-case anyone comes across this topic in the future and wants to do the same thing, here's what I did:

1. Create a new child theme (manually copy across Additional CSS & reset both logo and footer text)
2. Wordpress only seems to overwrite top level files, so you can't just create a new version of the relevant file in the child theme. Instead, copy the entire generate_comment function from inc/structure/comments.php (WITH the surrounding function_exists "if" statement) and paste into the child theme's function.php.
3. Remove the datetime span + surrounding tags in the function.php function

Nice one!

Personally, I'd create a custom filter for the date/time element incase I change my mind in the future about the dates but that's great. :D

Thanks for sharing it with us.

This archived topic is closed to new replies.