latest uodated date wordpress how to

Hello guys! In this blog post , you will learn how to add the “latest updated” date for any blog post or even custom post type in WordPress. This does help your website visitors to know if a post was recently updated, and has still relevant information.

Normally not all the themes on the internet display the latest updated date in the blog post page, but this is an important feature to add to your website. And also even though it will require some small coding, just copy paste, you dont need to be a professional programmer to do this.

Why do I need to display the latest updated date in WordPress?

That is a good question, because most of the themes come with displaying the created post date on each blog post. So giving that, think if you had a news website, and you would post a story and after 2 years you update the article. You would want to display the latest updated date, so your visitors knows there is still new information about that topic. This would also fit for having a pricing article, about hotels, or some goods, and after some time, the prices for those goods change. Would be a good practice to show the latest updated date, so your visitors know the prices are actually up to date.

And to be honest the more recent post, the more chances the clicks on it will be higher in numbers. Normally people tend not to click anymore on an article thats older than 2 years, as that becomes irrelevant. In some cases, and for some topics, the users will not consider the article relevant anymore, after a few days, or weeks. So displaying the latest updated post date in your wordpress website, is really important.

How can I actually do this?

You would have to login to wp-admin, and then go to edit your functions.php file and add some code. See below the exact sequence:

You have to go to: WP-Admin > Appearance > Theme Editor and then add the following code:


/*--- code here ---*/
  add_filter( 'the_content', 'sitemile_my_last_updated_date_cnt' );
  function sitemile_my_last_updated_date_cnt( $content ) 
      $my_new_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');
      $my_new_content .= "

".__('Last updated on ',''). $updated_date . "at". $updated_time ."

"; } $my_new_content .= $content; return $my_new_content; } /*--- code here ---*/

After this, just hit the save button, and your functions.php file will be saved. Now go back to your post page, refresh and observe the changes. From now on, the visitors of your website will know when that post would have been last modified or updated.

What if I cannot do this myself?

If for some reason you cannot edit the functions.php file from wp-admin area, then you either try to edit via cpanel (most cpanel system lets you edit files straight from the browser window), or if you have access to ftp, using Filezilla or similar client, you can connect, and edit the functions.php file straight from there.

Ultimately if you cannot do these things, and you want to hire someone to do this or any other custom changes to your wordpress website, you can hire our team. You can request a free price quote here.

This entry was posted in Blog, Do it yourself, Tutorials and tagged , , , , , . Bookmark the permalink.

Leave a Reply