How To display the last updated date of your posts in wordpress (Updated 2021)

Updating your old blog post content, it’s a good idea to tell your visitors that you’ve updated the post so that they know the content is still relevant. But The problem is, WordPress only shows the date when the post was last published, rather than when you most recently updated it, by default. So if you are looking for ways to display the last updated date of your posts in WordPress. Here is the easiest method for you to display the Last Updated Date of Posts in WordPress.

Displaying Last Updated Date in WordPress Posts

No matter what kind of website you’re running, if you want to add the “last updated” date to your published WordPress articles, The simple and easy method is to add the below code to your theme’s functions.php.

Simply log in to your WordPress blog, Then Appearance and select Editor. Here

function wpb_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 .= '<p class="last-updated">Last updated on '. $updated_date . ' at '. $updated_time .'</p>'
}
    $custom_content .= $content;
    return $custom_content;
}
add_filter( 'the_content', 'wpb_last_updated_date' );

display the last updated date of your posts in wordpress

This code checks to see if a post’s published date and last modified dates are different. If they are, then it displays the last modified date before the post content.

Display Last Updated Date of Posts using WordPress Plugin

The easiest way to show the last updated date of Posts in WordPress is by installing WP Last Modified plugin. This is a better option than editing the theme files.

  • Login to your WordPress admin.
  • Next, click on the Plugins option.
  • Now, click on the Add New option.
  • Enter WP Last Modified in the search Plugin field.
  • Now, the WP Last Modified WordPress plugin appears on the screen.
  • Next, click on the Install Now Button from that WP Last Modified Plugin.
  • WP Last Modified Plugin is now installed on your WordPress website.
  • Click on the Activate button.
  • Now, the WP Last Modified WordPress Plugin is installed and activated successfully.
  • After activation, click on WP Last Modified option under the Settings section.
  • Now, put a check mark behind check to activate.
  • Select the position where the updated date display.
  • Select the format of the date you want to display.
  • Enter the verb to display the updated date.
  • Put a check mark behind check to activate for activating the last updated date on posts.
  • Put a check behind check to activate for activating updated date on WordPress pages.
  • Now, click on the save changes button to store the changes you have done.
  • Try to update a post and check the updated date is displayed or not.

Hope this information is useful for you to show the Last Updated Date of WordPress Posts. also, Read How To Completely delete WordPress plugin From Database!

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More