How To Show Last Updated/Modified date In WordPress (Generatepress Theme)

This post is all about showing the last update date or last modified date in your post, and this technique will work in any theme, including GeneratePress Premium.

PHP Codes to Show Updated or modified date in Post

Follow My Steps To Show Last Updated or Modified in Posts

  • Login to Your WordPress Admin
  • Go to Appearance Settings
  • Click on theme Editor Option
  • Search for Function.php
  • Add this Following Code in it
// By Jatin Beniwal
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on: %2$s</time>';

    if ( get_the_date() !== get_the_modified_date() ) {
        $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Last Updated on: %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> ',
        $time_string
    );
}, 10, 2 );
  • Boom Guys ! “Last Updated” is Successfully Implemented On your Website Posts

Let me know if you have any doubts. Use the comment section it’s free!


One Request?


I worked hard on this post to help the blogging community. It would help me a lot if you consider sharing it on social media networks. Because Sharing Is Caring.. ♥️

Sharing Is Caring...

An aspiring BCA student formed an obsession with Blogging, SEO, Web Development and Helping Beginners To Build Amazing Websites.

Leave a Comment