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’);

Leave A Reply