How to display the Last Updated time of your posts in WordPress, better for SEO

How to display the Last Updated time of your posts in WordPress, better for SEO
Last updated on

In this article i will tell you how to display the last updated date (dateModified) of your posts in WordPress. This help you grab visitor’s attention and increase CTR (Click-Through Rate) from SERPs so it’s better for SEO.

Why we do ?

Most WordPress themes usually show the date when they published the posts (any blogs don’’t show date on their articles, this isn’t good for value in reading and SEO). If we don’t have last updated time then your reader might think your post is outdated, even incorrect. After all, they will left your blog and find the other pages. When we display the last updated date/time then your visitors or reader will know the content they are looking for is new and also give the impression that you’re still updating the content on your blog. So this help you grab visitor’s attention on your blog.

Furthermore, when showing the last updated date of our posts this is informing visitors about how timely the post is updated/edited. And most search engines like this, it will show in the SERPs (Search Engine Results Pages) so it’s better for SEO. The reader is more likely to click through to your post.

How to do it !?

1. Using WP plugins

The easiest way to show the last updated date that’s using a WP plugin. You can use Last Modified Timestamp plugin. With this plugin you can add last updated time in your posts by using the [last-modified] shortcode. This plugin also adds information to the admin interface about when your post/page was last modified.

Last modified time WP plugin

2. Using theme’s functions.php file

To do this please openfunctions.php file of your theme, this file is in location: /wp-content/themes/your-theme/ then putting the following code below into it (applied for the posts):

function oiw_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_attime = get_the_modified_time('h:i a');
$updated_time = get_the_modified_time('F jS, Y h:i a');
$custom_content .= '<span class="last-updated-time">Last updated on <time itemprop="dateModified" content="'. $updated_time .'">'. $updated_date . ' at '. $updated_attime .'</time></span>';
}
$custom_content .= $content;
return $custom_content;
}
if( !is_page() ){
add_filter( 'the_content', 'oiw_last_updated_date' );
}

3. Add the last updated time by manually

This medthod is a bit difficult because you need find specific theme files which you want to show the last updated date on them. Most WP themes use content templates or template parts/child to display posts (such as: single.php, archive.php, single-blog-style-xxx.php…). Then using the below code snippets to show the last updated date :

<span class="last-updated-time">Last updated on: <time itemprop="dateModified" content="<?php the_modified_date('l, F j, Y'); ?>"><?php the_modified_date('l, F j, Y'); ?></time></span>

CSS code (for reference):

span.last-updated-time{
font-style: italic;
margin-bottom: 8px;
display: inline-block;
font-size: 14px;
}
span.last-updated-time:before{
font-family: 'FontAwesome';
content: '\f044';
padding-right: 5px;
font-style: normal;
}

Note: I highly recommend you use itemprop="dateModified" (Schema Markup) into code of your last updated time. This code makes better for rich snippets, SERPs.

We hope this article helped you show the last updated time of your post. You may also want to take a look at How to start a blog with WordPress (passion and earning)

Leave your comment below and let me know what you think or if you need some helps !

    13 Comments

  1. I do this and it only shows the “Last updated on …..” on my index page and not on any of my post pages? I have been to several tutorials and keep getting the same issue. Not sure why?

    Reply

  2. Just wondering if you had any ways of making this into a column in the admin section. It’d be really useful for keeping tabs on when pages are updated by team members!

    Reply

    • Charlie,

      I think we shouldn’t make this into a column because it’s related to position of Last Updated time (where it is locate). If you don’t want to do that for all then you can use WordPress plugin with shortcode adding for each post. It will be more flexibility. This can be updated by team members if they want to use it.

      Reply

        • Yes, you are right GleoWPM. 🙂 Actually, it is fully up to Charlie. I am just suggesting him that he can also use this plugin to fulfil his need. If this plugin is helpful to anyone, then my work in this plugin will be successful. By the way, your guide in this post is very helpful. Thanks for this nice guide also. 🙂

          Reply

  3. This is really helpful as we are always looking for ways to expand on our SEO understanding and better promote ourselves as a business. Thanks so much for your help!

    Reply

  4. I am no longer sure where you are getting your information, however good topic. I needs to spend a while learning more or working out more. Thank you for great information I was searching for this info for my mission.

    Reply


Post a Comment

Please keep in mind that all comments are read and moderation.
Your email address WILL NOT be published. Please DO NOT use keywords in the Real Name field. Thank you !

Stablehost coupons - The best hosting in 2018

Categories