Adding a Last Updated date to your WordPress Post

It is very important to keep all your posts and information updated. Rather than creating new posts with similar content, it is suggested to update the information on your website / blog so that the reader gets the right information. This post will show how to display WordPress last updated date for a post.

WordPress Last Updated Date for a Post

I usually keep updating my blog posts like adding new information or even updating outdated information, but the post date will be the date when I initially published the post.

Add Last Updated Information on Post

I just added a few lines of code to display the Last Updated Date just before the post starts.

function addToContents($content) {
$updated='<strong>Last Updated: '.get_the_modified_date('F j, Y').' at '.get_the_modified_date('g:i a').'</strong>';
    if(is_single()) {
        $content = $updated.$content;
    }
}
add_action('the_content','addToContents');

You can add this code to the functions.php of your theme. I use a personal hacks WordPress Plugin to keep all my customisations at one place.

Why should you add the Last Updated Date to your Blog Post?

  1. Gives the right Information to the reader
  2. Shows How Old the content is
  3. Not Sure, but will be helpful for search engines too.

Other WordPress Hacks

  1. My Custom Archive Page Header
  2. Customise Post Content as per Post Format
  3. New Bootstrap with Genesis Framework Theme

Leave a Reply

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

%d bloggers like this: