Show readers when a blog post was last updated instead of only displaying the original publication date. This is useful for tutorials, guides, news, and other content that gets updated regularly.
Steps
- Add the code below to your theme’s
functions.php. - Save the changes.
- Open any WordPress blog post.
- The last updated date will appear before the post content.
/**
* Add last updated date to WordPress posts
*/
function custom_last_updated_date( $content ) {
if ( ! is_single() || ! is_main_query() || ! in_the_loop() ) {
return $content;
}
$updated_date = get_the_modified_date( 'F j, Y' );
$output = '<div class="last-updated-date">';
$output .= 'Last Updated: ' . esc_html( $updated_date );
$output .= '</div>';
return $output . $content;
}
add_filter( 'the_content', 'custom_last_updated_date' );
Tested on
WordPress 6.8
Reported by the author on September 24, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.3. It may still work.