TrustPulse Marketing Blog

Actionable advice to boost your website conversions.

How To Display and Change Last Modified Date in WordPress (Step-by-Step)

Do you want to display the last modified date on a post in WordPress?

You want your content to look fresh and updated even if you wrote it several years ago. Displaying a last modified date can help you climb the search engine rankings and build trust with readers.

In this tutorial, we’ll teach you how to easily display and change the last modified date of your posts in WordPress.

Table of Contents:

Displaying the Last Modified WordPress Date

Search engines look for new or recently updated content. So do readers, especially in fast-changing industries like tech or business. If a visitor sees a post written 5 years ago, they’re more likely to leave your site in search of more updated information. Of course, you might be able to catch some of those bounces with exit-intent popups. But why not convince them to stay on your site longer in the first place?

One way to do this is to display the last modified date in addition to the publish date. Visitors will see that the content is updated and therefore more reliable.

On the front end, WordPress defaults to the date a post was first published even if you update the post later. To change this publish date, you’d have to republish a post after unpublishing it. We have an easier way!

Let’s look at 2 ways to show the last modified date in WordPress:

What’s the best way to show the last modified date in WordPress?

Method 1 is easier than it sounds. You don’t have to write the code for Method 1 yourself, but you should be comfortable following technical instructions. Furthermore, you won’t need a third-party plugin. This can improve your site load time and reduce compatibility issues.

Method 2 is a perfect solution if you’d rather not mess with any code at all. The plugin makes it easy to configure your last modified date settings. Just remember to choose a plugin that is compatible with your theme, plugins, and WordPress version.

Method 1: Use Code to Display Last Modified Date

The first method is to add a snippet of code to your functions.php file or a site-specific plugin.

Be aware that if you update your theme or change to a different theme, you will lose the added code in your functions.php file. So we like to use a site-specific plugin.

Here’s the code you need to add:
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' );

If you need more help, follow this great step-by-step guide to creating a site specific plugin. It’s not as hard as it may sound, we promise!

Method 2: Use a Plugin to Display Last Modified Date

There are also premade plugins you can use to show the last modified date. Our recommendation is WP Last Modified Info, which is free to use and highly rated.

Here’s how to display last modified info with this plugin.

Step 1: Install the Plugin

You can download WP Last Modified Info for free from the WordPress plugin repository. Go to Plugins » Add New.

Search for WP Last Modified Info and click on Install Now.

Once you install the plugin, click on Activate.

Step 2: Configure the Last Modified Date

From the WordPress dashboard, go to Settings » WP Last Modified Info.

First, toggle on the Enable for Posts/Pages on Frontend switch. This will start displaying the last modified date on your posts.

Configure the following settings:

  • Display Method: The last modified date can go before or after your content, completely replace the published date, or be inserted manually with a shortcode
  • Format: Traditional format shows the actual last modified date, while human readable format converts it to however many hours, days, or weeks ago

You will get different settings to configure based on whether you choose traditional or human readable format.

You may also want to modify the copy in the HTML template to fit the format.

Traditional format would look better as: Last Updated on [date] by [author]

But human readable format would make more sense with something like: Last updated [time elapsed] ago by [author]

Make sure to click Save Settings when you’re done.

Now you will see the last modified date on all of your posts!

Changing the Last Modified Date

Using either of the methods shown above will automatically display the last modified date on your posts.

Sometimes, however, you may not want to change the modified date. For example, if you are just making small proofreading corrections, it could seem misleading to call it an update. If you recategorize older posts, that technically counts as an update. But it’s probably not necessary to show all of those posts as “updated” just because you changed the post category.

Fortunately, you can “freeze” the last modified date when making small updates or minor tweaks.

The best SEO plugin AIOSEO can not only manage your site’s search rankings, but it can also keep the post modified date from changing.

To learn more, check out this full AIOSEO review and learn how to get started optimizing your content for search.

Why You Should You Put Dates on Blog Posts

It’s best practice to always display dates on your posts, even if your content is not linked to a specific event or promotion. These days, information changes quickly, and recently updated content is often seen as more credible.

Modifying the Publish Date on a Blog Post

You change the actual publish dates on a blog post in WordPress. This can be helpful if you need to change the post’s position in your archive pages. Posts can be backdated or scheduled in advance. You can edit the publish date in the Publish settings box on the right-hand side of the WordPress dashboard.

Now you know how to display and change the last modified date in WordPress.

If you want to get even more visitors to your blog, check out how to create push notifications to drive more traffic.

Did you like this article? If so, please follow us on Facebook and Twitter for more free WordPress tips.

Author Photo
Published by Jennifer
Jennifer is a content writer and course creator. She has a passion for helping small businesses grow sustainably and ethically. In her spare time, Jennifer enjoys writing fiction, cooking, and exercising.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. We only recommend products that we believe will add value to our readers.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Increase Trust, Conversions and Sales NOW
Try TrustPulse 100% risk-free for 14 days!