Steps
- Add the PHP code to your theme’s
functions.phpfile or a PHP snippets plugin. - Save and activate the snippet.
- Update any blog post.
- Posts updated within the last 7 days will display an Updated Recently label.
/**
* Add an "Updated Recently" label to recently modified posts
*/
function custom_add_updated_recently_label( $title, $post_id ) {
if ( is_admin() || get_post_type( $post_id ) !== 'post' ) {
return $title;
}
$modified_time = get_post_modified_time( 'U', true, $post_id );
$days_ago = ( time() - $modified_time ) / DAY_IN_SECONDS;
if ( $days_ago <= 7 ) {
$title .= ' <span class="updated-recently">Updated Recently</span>';
}
return $title;
}
add_filter( 'the_title', 'custom_add_updated_recently_label', 10, 2 );
Tested on
WordPress 6.8
Reported by the author on November 2, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.4. It may still work.
