Site logo

Archived topic

How to show the post Updated date in Google Search

17 replies · Started by Abdul on October 18, 2020

Viewing posts 1–15 of 18

Right now when I update a post I am getting the updated date in the post but the same is not reflected in the google search results for that post

can you please let me know how to display the updated date in Google search results too.

Sounds good.

It should :)

the updated page date is not displayed in the google search. Please check the post mentioned in the private information section which was updated on Oct 19 but the search result still shows as Oct 12.

In the sitemap it shows updated on Oct 19

Hello,
I wanted the same thing and I added add_filter( 'generate_post_date_show_updated_only', '__return_true' ); using the code snippets plugin.
My question is, at the bottom, do I check "Run Snippet Everywhere" ?

Will the above work for dates on both posts and pages?

Many thanks!
Belinda

My question is, at the bottom, do I check “Run Snippet Everywhere”?

Yes :)

Will the above work for dates on both posts and pages?

By default, there isn't a time stamp in the markup of static pages.

Thank you Leo. Highly appreciate your quick response!
Belinda

No problem :)

Hello @Leo,

I have already the following two filters in my functions.php.

/***** Show the "Updated" Post Date in Header Element *****/
function post_modified_date() {
    return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' ); 
/***** Display updated date for WPSP Posts *****/ 
add_filter( 'wpsp_post_date_show_updated_only', '__return_true' );

If I add the filter noted in this topic, then the Updated on text is gone from my articles/posts.

/***** Show post updated date in Google Search  *****/
add_filter( 'generate_post_date_show_updated_only', '__return_true' );

Is it ok if I add the 'Updated on' text to the filter as follows?

/***** Show post updated date in Google Search  *****/
add_filter( 'generate_post_date_show_updated_only', 'Updated on', '__return_true' );

Here is my site for your reference: https://charbelnemnom.com

Finally, which filter should I take out and which one should I keep, so can I show the post Updated date in Google Search, as well as, on my WPSP home page, Blog page, and articles?

Thank You @Leo

Hi Charbel,

Is it ok if I add the ‘Updated on‘ text to the filter as follows?

/***** Show post updated date in Google Search *****/
add_filter( 'generate_post_date_show_updated_only', 'Updated on', '__return_true' );

No, that won't work.

Just add this -

/***** Show post updated date in Google Search  *****/
add_filter( 'generate_post_date_show_updated_only', '__return_true' );

and add this CSS:

time.entry-date.updated-date:before {
    content: "Updated on ";
}

Thank you @Elvin, much appreciated!

So, I have added the following two filters to cover all posts/articles and WPSP Posts on the home page as follows:

/***** Display updated date for WPSP Posts homepage *****/ 
add_filter( 'wpsp_post_date_show_updated_only', '__return_true' );
/***** Show post updated date in Google Search for Posts *****/
add_filter( 'generate_post_date_show_updated_only', '__return_true' );

Then, I have added the CSS you noted above and it works as expected. Thank You!!!

https://charbelnemnom.com/author/charbel-nemnom/ and
https://charbelnemnom.com/microsoft-teams-vs-zoom-how-to-determine-the-right-fit/

However, I have removed the previous function below since it's not needed anymore:

/***** Show the "Updated" Post Date in Header Element *****/
function post_modified_date() {
    return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );

Could you please confirm?

I would expect that Google search will pick up the updated date and show it once it crawls the articles, right?

Many Thanks, @Elvin!

I assume you're using that shortcode snippet on your header element but I'm not sure.

Try disabling it and see if something disappears.

I would expect that Google search will pick up the updated date and show it once it crawls the articles, right?

That should be the case on pages with updated dates because Google crawler bots will have no way of reading the published date because the only <time> tag that renders is the updated date.

Thank You @Elvin!

I have commented out/disabled that shortcode snippet for the header element and nothing gets disappeared. I will keep verifying.

As for Google Search, yes, I am interested in getting the updated date for articles/posts to show up during a search. Because I update my articles regularly and I don't see the updated showing when I perform a search.

I believe we are all set for now.

Thank You!

This archived topic is closed to new replies.