Display last updated date on articles

It’s a great idea to include the Published Date and Last Updated date on content you update regularly. This will let your readers know the content isn’t out-dated.

WordPress stores a published date and modified date for every post on your site.

You can use Limit Modified Date to make minor changes to an article (like fixing a typo) without changing the modified date.

There are a few ways you can display the modified date on your articles.

A Shortcode Option

If you’re using a Genesis theme, you can use shortcodes in the Post Info and Post Meta areas to display dynamic content (more information).

Genesis includes shortcodes for both the published date ([post_date]) and the modified date ([post_modified_date]). Here’s a full list of the available Genesis shortcodes.

But if you use the shortcode for modified date, it will always appear, even if it’s the same as the published date.

I personally prefer to only show the modified date if it’s more than a week later than the published date.

Add the code below to your theme’s functions.php file, or a core functionality plugin. You can then use [be_published_modified_date] to display the published date, and include the modified date if it’s more than a week later.

 * Published & Modified Date
 * @link https://www.billerickson.net/display-last-updated-date-on-articles/
function be_published_modified_date() {
	$date = get_the_date( 'U' );
	$updated = get_the_modified_date( 'U' );

	$output = '<span class="entry-date"><span class="label">Published on</span> ' . get_the_date( 'F j, Y' ) . '</span>';
	if( $updated > ( $date + WEEK_IN_SECONDS ) )
		$output .= ' <span class="entry-date-modified"><span class="label">Updated on</span> ' . get_the_modified_date( 'F j, Y' ) . '</span>';

	return $output;
add_shortcode( 'be_published_modified_date', 'be_published_modified_date' );

A Code Option

If you prefer including the code directly in your theme, include the same code listed above.

Then add the following to your theme file (ex: single.php) where you’d like the published and modified date to appear.

echo be_published_modified_date();

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions


  1. Mike Hemberger says

    Hey Bill,

    Just showing a different option I’ve used with Genesis. It still uses the [post_modified_date] shortcode, but returns an empty string if it’s less than a week old. Check it out:

    // Remove post modified date if it's not more than 1 week after publish date.
    add_filter( 'genesis_post_modified_date_shortcode', function( $output, $atts ) {
    	// Get the published and updated dates.
    	$updated = get_the_modified_date( 'U' );
    	$date    = get_the_time( 'U' );
    	// Bail if not newer than 1 week.
    	if ( $updated < ( $date + WEEK_IN_SECONDS ) ) {
    		return '';
    	return $output;
    }, 10, 2 );
  2. Doug says

    Thanks for the writeup. A final dot to connect before I try deploying. After adding the ‘Published & Modified Date’ code to functions.php, I would then modify Post Info and include the [be_published_modified_date], such as below?

    function be_post_info_filter($post_info) {
    $post_info = ‘[be_published_modified_date] by [post_author_posts_link] [post_comments] [post_edit]‘;
    return $post_info;
    add_filter(‘genesis_post_info’, ‘be_post_info_filter’);

  3. Ariel says

    Thanks for this Bill. Exactly what i’m looking for. And frankly, the only one i saw who wrote about a condition (if date modified is longer than a week, etc).

    I’d like to ask, how would you change the conditional section if i want it to be 3 months or 6 months or older (instead of a week)?

    • Bill Erickson says

      Great question! Change `WEEK_IN_SECONDS` to `3 * MONTH_IN_SECONDS` or `6 * MONTH_IN_SECONDS` to make it 3 months or 6 months, respectively.

  4. Rajibul Islam says

    I am getting “Last updated on” by following codes. Will you please tell me, How can I show this last updated date after content?

    //* Customize the entry meta in the entry header (requires HTML5 theme support)
    add_filter( ‘genesis_post_info’, ‘sp_post_info_filter’ );
    function sp_post_info_filter($post_info) {
    $post_info = ‘Last Updated On [post_modified_date] by [post_author_posts_link] [post_edit]‘;
    return $post_info;

    • Bill Erickson says

      You’re using the genesis_post_info filter which runs before the post content. Change that to genesis_post_meta to alter the metadata that appears after the post content.

  5. WEN HUI says

    Thanks for your informations,it’s useful with AVADA theme.
    One question I have:
    Is there a way to only display this on posts (and not on any pages)?
    Thanks for any help!

    • Bill Erickson says

      Before outputting the modified date, you could check if( is_single() ) to ensure the code is only running on single posts.

Leave A Reply