Select Page

If you update your blog regularly, you might want to display the Last Update date under your posts instead of the posted date. Displaying the last updated date also tells Google your content is fresh and updated.

Place this snippet where you want to display the Last Updated date in your theme’s code:

$time_right_now = get_the_time('U'); 

$last_modified_time = get_the_modified_time('U'); 

if ($last_modified_time >= $time_right_now + 86400) { 
	echo "<p>Last updated on " . the_modified_time('F jS, Y');
} 

The above code displays the date a post was last updated on. It checks if the last modified date is earlier than one day and then displays the date if it is.