By default, WordPress shows the original published date on the posts or pages no matter how many times you made changes to it, but this is not always welcome. Sometimes you would like to show users when the article was last updated. Google also pick up the date that appears on the post and display it in the SERPs, informing users about how timely the post is. That way, if users sees your post in the search results, they are more likely to click through to the page, as they assume that the information available will be up to date. So  in today’s post, we will show  how easy it is to display the last updated date for posts in WordPress.

Using WP Last Modified Plugin

The easiest way to display the last updated date for WordPress posts, is by installing a plugin called “WP Last Modified“. This is usually a better option than editing the actual theme files because – unless you use a child theme – your edits will be lost when the theme is updated.

The plugin is really easy to use, too; there’s just a few simple fields for you to configure. To begin configuring the plugin, head to Settings > WP Last Modified.

You can display the last modified date on your posts and pages either below or above the published content. Modify the date style and text with the plugin.

Also you must know that the plugin is old and hasn’t been updated for two years. So a lot depends on the compatibility of your plugin and theme.

Adding code to your WordPress files 

You will need to add this code to your theme’s functions.php file:

function sow_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 .=Last updated on '. $updated_date . ' at '. $updated_time .''; 
   } 
   $custom_content .= $content; 
   return $custom_content; 
} 
add_filter( 'the_content', 'sow_last_updated_date' );

The updated date will show before post content.

Conclusion

Displaying the last update stamp can have a big impact on your website’s success: visitors will trust updated content more, and the search engines will update their records the next time your website is crawled.