• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

How To Display The “Last Modified” Date On Posts

Bhagwad Park

Published on: February 18, 2019

Categories: WordPress 3

Article freshness is an important aspect of maintaining a site. Too many of them focus on churning out new content, without a care for updating old posts and pages. Some content of course, is evergreen. “How to” articles are a great example. You’ll find a whole bunch of them here on the NameHero blog!

But others like best deals, special offers, event description, product review etc are all related to freshness. No one wants to read a review of a product that’s two years old. This is especially important if you include the year or the date in your review! It won’t do to simply change the title to the new year every 12 months. The content itself needs to be refreshed and updated with the latest information.

We know that even Google takes cognizance of this. Every so often, you’ll see search results with a “Last Updated” tag next to it. It’s an example of the “rich results” feature of Google. The richer the results you get, the higher the chances of visitors noticing and clicking through.

We Need to Let Google Know

But it’s not enough to merely update your articles. We need to ensure that Google knows that we’ve done so! If you’re using proper schema markup, you probably already have a “date published” snippet in your HTML. So Google knows when the article was first created. But we can also include the date when it was modified. And that’s equally important.

We also want to display this near the top of our posts so that the user can note the freshness. Like this:

Last Updated Time on WordPress

And when properly done, we can mark it up so that it shows up as structured data in Google’s structured data testing tool like so:

Last Modified Date on Posts

The following steps will show you how to implement this.

Adding the Modified Date above the Post with Structured Data

Open up your functions.php file and add the following code:

function append_updated_time( $content ) {
$updated_date = get_the_modified_time('F jS, Y');
$updated_time = get_the_modified_time('c');
$custom_content .= 'Last updated on '. $updated_date . '

';
$custom_content .= $content;
return $custom_content;
}
add_filter( 'the_content', 'append_updated_time' );

If you don’t know how to add code like this, you can check out the NameHero knowledgebase for a complete tutorial on how to add code snippets in WordPress.

The code above does two things:

  1. It gets the last modified date from the WordPress database and pastes it above the content. This way, everyone can see when a post was last modified.
  2. It adds in structured data markup that can be picked up by robots.

The latter is done using the <time itemprop=”dateModified”…> tag. This HTML is invisible to users, but visible to search bots. When they see it, they can parse it properly and know when a post was updated.

Then they can either choose to show it in their search results, or take it into account for ranking purposes, or whatever. Personally, I’ve found that search engines tend to give a little more love to frequently updated page. This isn’t a scientific observation, just an impression. It could also mean that frequently updated pages are better pages in general, but I can’t be sure.

So if you have a site with a lot of articles, it’s good to take a few minutes to add this code to your WordPress installation. It provides users with a visual indication of the freshness of an article, and it assists search engines to better evaluate your page for ranking purposes!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Related Posts

How To Start A Newsletter In WordPress

Check out our complete guide on why and how you should start your own newsletter in WordPress.

How to Eliminate Render-Blocking Resources in WordPress (& Why You Should)

Many things can slow down your site, including render-blocking resources. These are CSS and JavaScript files that delay the loading of content on your site. As a result, visitors will have to wait longer to interact with your page, which could lead to frustration and instant exits.  So, what can you do to eliminate render-blocking […]

How To Back Up Your WordPress Site (And Why You Should Do It Today)

In this post, we’ll take a closer look at why backups matter. We’ll also show you different ways to back up your WordPress website.

What Is Self-Hosted WordPress?

In this post, we’ll differentiate self-hosted WordPress from WordPress.com, and discuss the benefits of the former.

Reader Interactions

Comments

  1. Philip says

    January 10, 2021 at 1:53 am

    Ah, this is helpful and good to know in WordPress–but is there a way in good ol’ PHP without the WP dependancies?

    Reply
  2. Aakash Dudhat says

    February 17, 2021 at 12:48 pm

    How to show last. Updated date in google search results for blogger platform blog

    Reply
  3. PiroMax says

    May 27, 2021 at 2:12 pm

    I think it makes sense to periodically update all of your articles. Add content and update the date. Google loves this and the position of the article will only improve.

    Reply

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA