How To Display Last Updated Date of Post in Search Engine and WordPress

Well if you modified your post of WordPress then the last modified date shall appear on your blog and as well in the search engine to rank on page No. 1.

Dec 13, 2022 - 10:59
Dec 13, 2022 - 11:06
 0  7

In This video, I will teach you how you can show the last updated/modified date of your WordPress post in search engines and on a blog post. 

This is a very easy tutorial. You need to follow the steps carefully and watch the complete video. 

Follow the steps below. 

  1. Open your WordPress dashboard.
  2. Go To appearance and then Theme file editor
  3. Then go to the theme function file
  4. Paste the following code at the bottom of the file
  5. Hit Update file button

You are good to go now. Update any of your posts, and the updated date will appear on the post and reflect in the Google search engine.

// By Web Dareecha.pk
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    $time_string = 'Published on: %2$s';

    if ( get_the_date() !== get_the_modified_date() ) {
        $time_string = 'Last Updated on: %4$s';
    }

    $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( '%s ',
        $time_string
    );
}, 10, 2 );

If you need help understanding or help, please write to me in the comment box or on the YouTube channel. 

Remember to subscribe to my channel as I share money-making ideas and SEO tutorials online. 

like

dislike

love

funny

angry

sad

wow

Shahzaib Anwar Enthusiast Young & Passionate Learner born in the 90s in Lahore, Pakistan. Digital Marketer & SEO expert by Profession & Bloggers by Passion.