[Resolved] Last updated date on Google Search

Home Forums Support [Resolved] Last updated date on Google Search

Home Forums Support Last updated date on Google Search

  • This topic has 5 replies, 4 voices, and was last updated 4 years ago by David.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #887361


    Although on my blog it shows last updated date, on Google search page it shows the publish date. How I can show the last updated date on Google search page.

    Here is my blog url.



    Lead Developer
    Lead Developer

    Hi there,

    Ultimately it’s up to Google whether to display it or not.

    However, some users have reported success by removing the published date from the HTML completely if an updated date exists: https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date


    Thanks Tom your code worked. Now Google is showing last update date.

    Lead Developer
    Lead Developer

    Awesome – glad I could help 🙂


    Hi tom, do you want to say that if I’ll add this code only then Last updated date will show in the Google search result.

    add_filter( 'generate_post_date_output', function( $output, $time_string ) {
        $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
        if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
            $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>';
        $time_string = sprintf( $time_string,
            esc_attr( get_the_date( 'c' ) ),
            esc_html( get_the_date() ),
            esc_attr( get_the_modified_date( 'c' ) ),
            esc_html( get_the_modified_date() )
        return sprintf( '<span class="posted-on">%s</span> ',
    }, 10, 2 );

    If yes,

    then Please tell me where to add this code and how to add this code?

    Waiting for your reply…

    Customer Support

    Hi there,

    yes that code will output the updated date if one exists if not it will return the published date. The code is PHP, this article covers the methods of adding:


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