Display Updated Date of Your Post in WordPress

If you want to show the updated time of your WordPress post, you can use the following function on your theme’s single.php & archive.php pages. Ideal spot to place the following line should be after the default WordPress date and time function.

<?php post_updated_time('F jS, Y');?>

Simply go to the functions.php file of your theme and place the following snippet.

$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
  if ($u_modified_time >= $u_time 86400) {
    echo ", Updated: ";
    post_updated_time('M j, Y'); } 

By default, updated time will not be visible. It will be shown only after re-editing any published post. To test it out, you should try with any post which is at least a day old.

Today In History



Leave a Reply

Note: Convet HTML, PHP, JavaScripts from HTMLify, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.