How to Display and Change Last Modified Date in WordPress

Are you trying to display the last modified date in WordPress?

Showing when your content was last updated can build trust with readers and help you climb the search engine rankings.

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

Table of Contents:

How to Display Last Modified WordPress Date

By default, WordPress only shows when a post was first published. To update the publish date, you’d have to unpublish a post and then publish it again. What a hassle!

Search engines prioritize new and updated content. If visitors see a publish date that’s years old, they’re more likely to bounce off your website. Sure, you can recover some of those with exit-intent popups, but why not keep them 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.

We’ll show you 2 methods to display the last modified date in WordPress:

You don’t have to write the code for Method 1 yourself, but you should be comfortable following technical instructions. The benefit is that you’re not dependent on a third-party plugin.

If you’d rather not mess with any code at all, Method 2 is an easy solution. You’ll just need to keep an eye on whether the plugin is compatible with your version of WordPress and any theme or plugins you use on your website.

Method 1: Show Last Modified Date Using Code

The first method is to add a snippet of code to a site-specific plugin.

You can also add this code to your theme’s functions.php file. But if you update your theme or change to a different theme, you will lose the added code. So we like to use a site-specific plugin.

If you already know how to create 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’re not sure how to use a site-specific plugin, follow this great step-by-step guide. We promise it’s easier than it sounds!

Method 2: Show Last Modified Date With WP Last Modified Info Plugin

You can also use a premade plugin to show the last modified date. We recommend WP Last Modified Info. It’s free to use and highly rated.

Here’s how to set it up.

Step 1: Install and Activate the Plugin

WP Last Modified Info is available from the WordPress plugin repository. Go to Plugins » Add New.

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

The button will change to say Activate after installation. Click on Activate.

Step 2: Configure the Last Modified Date

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

Toggle the Enable for Posts/Pages on Frontend switch to start displaying the last modified date.

Customize the display settings as you wish.

  • Display Method: You can place the last modified date before or after the content, replace the published date, or insert manually with a shortcode
  • Format: You can choose traditional (shows the date) or human readable (shows how long ago)

Depending on whether you choose the traditional or human readable format, different settings will appear for you to configure.

You’ll also want to customize the HTML template accordingly. This will help make sure that the text makes sense.

For example, the HTML template for traditional format might look something like:

<p class="post-modified-info">Last Updated <strong>on</strong> %post_modified% by <a href="%author_url%" target="_blank" class="last-modified-author">%author_name%</a></p>

On the other hand, the HTML template for human readable format could look like this:

<p class="post-modified-info">Last updated %post_modified% <strong>ago</strong> by <a href="%author_url%" target="_blank" class="last-modified-author">%author_name%</a></p>

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

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

How to Change the Last Modified Date

If you use either of the methods outlined above, your posts will automatically show the last modified date.

But sometimes you may not want to show every single update, such as small proofreading corrections. Or perhaps you add a new category to your site and need to recategorize older posts. You wouldn’t necessarily need to show that all of those posts were “updated” just because the category changed.

Fortunately, it’s also easy to “freeze” the last modified date when making small updates or minor tweaks.

When you use the best SEO plugin AIOSEO to manage your site’s search rankings, you get an added bonus! You can easily keep the post modified date the same.

Read our full AIOSEO review and learn how to get started optimizing your content for search.

Should You Put Dates on Blog Posts?

Yes, we believe you should always have dates on your blog posts. Even if your content is “evergreen” and not linked to a specific event or promotion, it’s still best practice to display dates. Information changes quickly, and recently updated content is often deemed more trustworthy.

Can You Change the Date on a Blog Post?

Yes. In addition to displaying the last modified date, you change the actual publish dates on a blog post in WordPress. You can backdate posts or schedule posts to publish in the future. This can be helpful if you need to change the post’s position in your archive pages.

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

If you want to get even more traffic to your blog, check out how to optimize your content for featured snippets.

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

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, she 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.

Comments

  1. Thomas Griffin May 13, 2022 at 1:37 am

    Thanks for reading this article – I hope you found it helpful.

    I wanted to let you know about our powerful Exit Intent® technology that converts abandoning website visitors into email subscribers and customers. Typically 70% of the people who visit your website will leave and never return, meaning all those marketing efforts to reach them have gone to waste.

    OptinMonster’s Exit Intent® technology detects user behavior and prompts them with a targeted campaign at the precise moment they are about to leave.

    You can unlock this powerful technology 100% free when you purchase our OptinMonster Pro plan.

    Get started with OptinMonster today and see why 1,000,000+ choose OptinMonster to get more subscribers and customers.

    Thomas Griffin
    President of OptinMonster

  2. Well, for example, if I have a blog for applications, and in each article I make a paragraph that contains a button to download the application and a table that contains the version number of the application, the date of release and information, and when updates come out, I modify the articles and sometimes it is more than 15 articles in one day. I change the download links, the date of release and the version number And make an update to the article without changing the date of publication. Is displaying the date of the last update useful for me or not? You said in your article that small modifications are not desirable,, What do you think, should I do it useful, or are modifications such as changing download links, version number, date and size considered small modifications?

    1. Jennifer
      Jennifer Duann Fultz August 25, 2022 at 11:31 am

      I think these are small modifications. When you change the last modified and publication dates on the article, you’ll be reordering the articles in your post archive page. That may not matter too much to you, but if you care about what order you’re placing the articles in, you don’t want to change the dates. If you’re frequently updating the application versions, you may want to consider hiding the publish/modification date on the article completely, and having the table of version numbers, release dates, etc. close to the top. Hope this helps!

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.