How to Display the Last Updated Date of Your Posts in WordPress

Do you want to display the last updated date for your posts in WordPress?

Some websites update their posts regularly. Showing when each post was updated makes sure your readers don’t miss any content, and helps build trust.

In this article, we will show you how to display the last updated date of your posts in WordPress.

How to Display the Last Updated Date of Your Posts in WordPress

Why Display the Last Updated Date of Your Posts in WordPress?

When visitors view a post or page on your WordPress blog, your WordPress theme will show the date when the post was published. This is fine for most blogs and static websites.

However, WordPress is also used by websites where old articles are regularly updated. In these publications, it is important to display the date and time the post was last modified.

For example, on WPBeginner, we regularly update our tutorials and show the ‘last updated’ date on each post. If we only displayed the published date, our readers would skip the post, assuming the information is out of date.

Example of Showing the Update Date of a Post

Another example is news websites. They often update old stories to show new developments, add corrections, or media files. If they only added the published date, then their users would miss those updates.

Having said that, let’s take a look at how you can easily display the last updated date for your posts in WordPress.

Video Tutorial

Subscribe to WPBeginner

If you prefer written tutorial, then please continue reading the guide below.

How to Display the Last Updated Date of Your Posts in WordPress

This tutorial requires you to add code to your WordPress files. If you haven’t done this before, then we recommend you take a look at our guide on how to copy and paste code in WordPress.

Method 1: Showing Last Updated Date Before Post Content

First you need to connect to your website via FTP or your WordPress hosting file manager.

Then browse to your theme’s functions.php file which is located in the /wp-content/themes/yourthemename/ folder.

You will need to add this code to your theme’s functions.php file or a site-specific plugin.

function wpb_last_updated_date( $content ) {$u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_modified_time >= $u_time + 86400) { $updated_date = get_the_modified_time(‘F jS, Y’);$updated_time = get_the_modified_time(‘h:i a’); $custom_content .= ‘

Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .’

‘;  }       $custom_content .= $content;    return $custom_content;}add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

The code checks to see if a post’s published date and last modified dates are different. If they are, then it displays the last modified date before the post content.

You can add custom CSS to style the appearance of the last updated date. Here is a little CSS snippet that you can use as a starting point:

.last-updated {    font-size: small;    text-transform: uppercase;    background-color: #fffdd4;}

This is how it looks on our demo WordPress website.

Preview of Displaying Update Date by Editing functions.php

Method 2: Adding Last Updated Date in Theme Templates

You can also display the updated date in place of the published date, or just below it.

This method requires you to edit specific WordPress theme file. The files you need to edit will depend on the theme you are using.

Many WordPress themes use their own template tags to show post meta data like date and time. Other themes use content templates or template parts. Simpler themes will use single.php, archive.php and other template files to show content and meta information.

You need to look for the file that contains the code responsible for displaying the date and time. You can then either replace that code with the following code or add it right after your theme’s date and time code.

$u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_modified_time >= $u_time + 86400) { echo “

Last modified on “; the_modified_time(‘F jS, Y’); echo ” at “; the_modified_time(); echo “

“; }

You can delete lines 6 and 7 if you don’t want to display the time the post was updated.

This is how it looked on our demo site. With the Twenty Twenty-One theme, we added the code snippet to the template-tags.php file inside the inc folder.

Preview of Displaying Update Date by Editing Template

How to Manage the Last Updated Date of Your Posts in WordPress

Now that we have added the last updated date for each post, it will automatically update every time you make a change to any post. But what if you’re only making a small correction rather than a full update, such as fixing a spelling mistake or adding a tag.

For small changes, it is usually best to leave the modified date unchanged from SEO perspective. Your readers will then see the date when the last major update was made to the post.

Here are a few plugins that let you update a post without changing the modified date.

Method 1: Using the Limit Modified Date Plugin

First, you need to install and activate the Limit Modified Date plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Note: This plugin has not been updated recently. However, we tested it with the latest version of WordPress and it is still working.

Upon activation, you will see a new checkbox when editing posts. It is labeled ‘Don’t update the modified date’.

Checkbox Added by Last Updated Date

When you do a minor update to a post, simply check that box and the modified date will not be changed.

Method 2: Using the AIOSEO Plugin

AIOSEO also known as All in One SEO is the best WordPress SEO plugin on the market. It helps you improve search rankings without learning complicated jargon, so you can increase your website traffic.

You can learn more in our guide on how to set up All in One SEO for WordPress correctly.

If you’re already using AIOSEO to improve your search engine rankings, then you can use it to manage the modified date of your posts as well.

Upon activation, you will find a new checkbox when editing posts, labeled ‘Don’t update the modified date’. You can check the box when making minor changes to a post.

Checkbox Added by AIOSEO

We hope this tutorial helped you learn how to display the last updated date of your posts in WordPress. You may also want to learn how to speed up WordPress performance, or check out our list of proven tips to increase your blog traffic.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.