How To Display The Last Updated Date Of Your Posts In WordPress
How To Display The Last Updated Date Of Your Posts In WordPress 

Is our goal to simply display the last updated date for each and every one of your posts in WordPress? There are a few websites that update their posts on a regular basis and would actually like showing their users when the article was last updated. 

Our article will show you the exact way that you can simply display the last updated date of every single one of your posts in your WordPress site. 

When Are You in Actual Need of the Last Updated Date for Posts in WordPress?

It is quite well known that majority WordPress themes usually display their dates when their post was last published. This is perfectly fine for majority blogs and even static websites. 

But, WordPress is even utilised by those types of sites where the previous articles are quite regularly updated. Which is exactly why the last updated date and time is a pretty important factor for those various publications. 

You can also watch the video tutorial:

News websites are actually one of the most common examples in existence. Old stories are updated many times so that new developments, corrections, or media files can be shown. If only the published date would be visible then a whole lot of users would miss many updates. 

There are many well known blogs and sites that don’t bother showing any type of date in their articles. This is quite a bad habit and it’s suggested that you never actually remove those dates from all the posts from your blog. 

Now, on that note, let’s further move ahead with the article and figure out how you can really display the last updated date of your posts in WordPress. 

How To Display The Last Updated Date Of Your Posts in WordPress?

Keep a short note in mind that this guide would actually require you to simply add code to your WordPress files. If you haven’t made a backup of your website, we would suggest that you go and do it right now so that if something goes wrong, you can at least restore the backed up version. 

Method 1: 

  • Open up your WordPress admin area. 
  • Hover on to Appearance.
  • Further tap on Theme Editor. 
How To Display The Last Updated Date Of Your Posts In WordPress
  • Now, you’ll see that on the right side, you are required to select the Theme that you want to edit in. 
  • Tap on Theme Functions. 
  • Now, you have to go and scroll down to the end. 
How To Display The Last Updated Date Of Your Posts In WordPress
  • This is exactly where you are required to add the following code. 
How To Display The Last Updated Date Of Your Posts In WordPress


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' );
How To Display The Last Updated Date Of Your Posts In WordPress

This code would be checking whether a post’s published date and the last edited date are different or not. In the case that they are, it would display the last modified date right before the post content. 

You even have the option ton add Custom CSS if you wish to style the appearance of the last updated date. A little CSS has been given below in case you want to use it. 


.last-updated {
    font-size: small;
    text-transform: uppercase;
    background-color: #fffdd4;
How To Display The Last Updated Date Of Your Posts In WordPress

Method 2

You would have to add the Last Updated Date in the Theme Templates. 

This specific technique would require you to edit the specific WordPress Theme Files. A lot of WordPress themes now have started using their very own template tags which clearly define how exactly all these themes would show the post meta data such as the date and time. 

There are a few themes that would also make use of the content templates or even the template parts if they wanna display the posts. 

There are a few simple themes that would use just a single.php, archive.php, and some other template files if they wanna show their content and meta information. 

We have mentioned the code which would be responsible for displaying the date and time, right below. So, you can either replace the previous code with the code given below, or you even have the option to 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 "<p>Last modified on ";
the_modified_time('F jS, Y');
echo " at ";
echo "</p> "; }

Hopefully, our article managed to help you in learning all the possible methods to display your last updated date for all your posts in WordPress. In case you happen to have any more doubts or questions, feel free to check out our website Digital Suncity and do not hesitate in contacting us. 

Read More: How To Disable The Screen Options Button In WordPress


Submit a Comment

Your email address will not be published. Required fields are marked *

Need Professional Help?

We can help you with website fixes and ongoing maintenance.