How to Add Last Modified Date / Updated Time Markup to WordPress Articles

It is very important to add last modified date and updated dates / time markup to your blog articles. Google and other search engines are tweaking their algorithms to favor fresh content. If you test your site on the structured data tool, it seems Updated date has become a necessary hentry requirement if you do microformats markup for all site pages. This is beside the article published date!

updatedWe have added the updated date to all our posts, besides the published post date. This is a good idea as people update old articles and content and this provides an official way for search engines to know when the content was updated. WordPress will save the date your content was updated and will help you publish the updated date easily.

What if you do not publish updated date?

If no Entry Updated element is present, it defaults to Entry Published element, and if that too is absent, then its invalid hAtom markup.

It is important that you add the post updated mark up to your html code and help search engines know when your post was last updated. Its is also important NOT to fool search engines like Google by labeling all content as updated today, if there are no changes in your page, because they are smart enough to detect changed content.

How to markup the last modified date?

Use this simple class updated to specify the updated date in your html code.

Can WordPress automatically display updated date?

Its easy. We use this code with the date and updated class. Then the the_modified_time php code prints the updated date automatically.

<span class="date updated"><time datetime="<?php the_modified_time('d/m/Y'); ?>"><?php the_modified_time('d/m/Y'); ?></time></span>

This code will publish the time your post was last updated. This is not the same  as your post published date (which should have a published class). You can choose different date format than d/m/Y as allowed by PHP time tags to customize the updated date the way you like it.

For example Y/m/d g:i:s A will output the date as 2013/07/09 12:51:28 AM

Should you replace original date with updated date?

Readers would like to know when the content was published. Outdated content corrected for grammatical errors will give a new updated date, but that does not make the 5 year old news item new for the reader. So we prefer to  keep both dates on our pages.

Update: learn how to add updated date to WordPress themes like 2013 or 2014 theme.

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.