How to show updated time if post was modified – WordPress

Would you like the updated date of a post only when the post was actually modified?

Compare the modified date with the date of publishing and show the text only if the modified is actually bigger.


<?php if ( get_the_modified_time('U') > get_the_time('U')) { ?> <p><small>Updated: <?=get_the_modified_date()?></small></p> <?php } ?>
Code language: HTML, XML (xml)


Leave a Reply

Add <code> Some Code </code> by using this tags.