How To Show A Last Modified Date on Your WordPress Posts
On one of my main blogs I maintain several reference posts which are updated regularly in the hopes that they remain a valid resource for my readers. So far these posts have proven to be pretty beneficial to search engine traffic and well received by readers that reference them regularly.
If you run a blog where posts are regularly updated, you may want to consider updating your post meta data to also reflect the last modified date when applicable, rather than showing just the original posting date.
In order to do this, we had posted before a quick code hack to get your single pages to reflect the last modified date. We used the default Kubrick theme, but it easily apply to just about any theme.
As always, you’ll want to make a backup of your single.php file (or any files you will be changing) before proceeding.
Look for the code that displays the post date. It should look something like the following:
Posted on: <?php the_time('l, F jS, Y') ?>
Now replace it with the following code (slightly modified from our previous post):
Posted on <?php the_time('F jS, Y') ?>
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time != $u_time) {
echo "and last modified on ";
the_modified_time('F jS, Y');
echo ". "; } ?>
Now your posts should show the last modified date immediately after the original posting date, rather than just showing the original post date! We use this on most of my blogs and we are very pleased with it.
Related Resources:
- How to Show a Post’s ‘last modified’ Date in WordPress
- How to Show Only Posts With Certain Custom Fields
- How to Create Posts Only For Your RSS Subscribers in WordPress
- Video Tutorial Explaining The Query Posts Widget Plugin
- Tips for Creating Fully Valid, SEO-Friendly Social Media Links for WordPress





