When you start your own blog with WordPress and publish a post, most themes will display the published date. Often web masters tend to update old content and the published date on the WordPress posts is still the same. This may put a doubt in the mind of users as they may think the content is old and irrelevant.

If you were to display a last updated date instead along with the published date, it will help increase user engagement and retention. It can also lead to repeat website visitors, as the visitors know that content is often updated on the website.

While most WordPress functionality can be added via amazing plugins, for this there are no plugins available currently. The plugins available have not been updated in a long time and may have compatibility issues with newer versions of WordPress. If you want to display the last updated date for WordPress posts, you will have to edit some code on your website. While it may seem tricky at first sight, it is in fact not very hard if you follow this stellar tutorial that we have put together.

Why You Need to Display the Last Updated Date in WordPress?

Displaying the last updated date can be useful especially useful for news websites. News websites often tend to update articles with the latest developments. Displaying the last updated dates can be appropriate in such a situation.

The last updated date can also be useful for tutorial websites. Especially where the tutorial is on software and new versions of software are released periodically. Take for example a WordPress tutorial blog, with the major update of WordPress 5.0 that was rolled out a few months ago, it introduced along with it the Gutenberg editor. WordPress tutorials that have been written on the classic editor will now need to be updated. If a user were to see the tutorial was written a few years ago, even though the web master has updated it, they may leave the website without spending any time on it. In such circumstances displaying the last updated date can be very useful.

Step by Step: How to Display the Last Updated Date for WordPress Posts

Step 1: Accessing the functions.php file

Login to your WordPress dashboard under the Appearance menu click on Theme Editor

Editing the functions php file

On the right hand side you will find a number of files that are installed with WordPress and your current theme. Search for the functions.php file on the right hand side, click it to start editing the file.

Step 2: Adding code to the functions.php file

At the bottom of your functions.php file simply copy and paste the code below. An example is shown. Click on update file once done.

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 .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;



$custom_content .= $content;

return $custom_content;


add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

Adding code to the functions php file

This code, checks if the published date and the last modified date of the post is different. If different it displays the last updated date on the WordPress post.

After adding this code to the functions.php file you will find the last updated date being displayed in your WordPress posts. Here is an example of a post that we updated.

Front end view of last updated date on a post

As you can see the posted date is May 1 2019 but the last updated date is May 19th 2019.

If you wanted to style this differently you can add custom css code in your theme and change the look of this. Here is an example of the custom css code:

.last-updated {

font-size: small;

text-transform: uppercase;

background-color: #fffdd4;



If all this feels a little overwhelming and you absolutely want to avoid playing around with code on your website, you can use a plugin such as Last Modified Timestamp. The only issue with this plugin is that it has not been updated for some time. It has not been tested with 3 major releases of WordPress and so might be an outdated solution.


Often plugins tend to slow down your website and sometimes have compatibility issues. It is generally a good practice to avoid using plugins wherever possible in WordPress. Always make sure you take a backup of your website before editing code.

You may also want to learn how to display recent posts in WordPress to always serve the latest content.