Display WordPress last update time in blog post

In this post I will show you how we can display the last update time of our blog post in our WordPress blog. Most of the WordPress theme does not show Update time even most of the blog remove post or update date which very important for blog and SEO point of view. If your theme has missing Update time feature you can add that with help of few lines of code inside your WordPress theme functions.php file or you can directly add code on your page.

When you need last update time in WordPress

some time we need to update our older blog post so you get exact data information you need.

Most of the old and latest WordPress theme does not display update time of post which is not a good thing ex. think if you have post which is one year old and now you update the content of the post but when the user visits your website and check date hi think this post is not updated which is not good so it is always a good point to show update time in your post through which user and search engine easily understand that you post is regular updated.

How to display update time in WordPress

You can need to update your WordPress theme to display Update time in your post follow below simple steps to do that.

Step 1. Login to your WordPress from Filezilla.

Step 2. Go to wp-content -> themes -> mytheme and edit functions.php file.

Step 3. Once your file is open in your editor paste below code in that file

function 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_time = get_the_modified_time('h:i a'); $custom_content .= '<div class="updated-time">Last updated on '. $updated_date . ' at '. $updated_time .'</div>'; } $custom_content .= $content; return $custom_content;
}
add_filter( 'the_content', 'last_updated_date' );

That’s it I hope this post helps you to understand how we can display WordPress post update time in our WordPress theme.

Related Posts