Show The "Last Modified" Updated Date in WordPress

James Parsons by James Parsons Updated Feb 2nd, 2024

If you want to show the "Last Modified" date instead of the published date, you can edit your theme's single.php file and replace your date code with this code:

<?php if (get_the_modified_date() !== get_the_date()) : ?>
    Last updated on: <?php echo get_the_modified_date(); ?>
<?php else : ?>
    Published on: <?php echo get_the_date(); ?>
<?php endif; ?>

With this code, it will show the current date on the day it is published, and then it will show "Last updated on:" once the day passes.

If you want to show the "Updated" date in all cases, even on the day you publish your content, you can simplify this by instead using:

Last updated on: <?php echo get_the_modified_date(); ?>

Related Code Entries

Written by James Parsons

James Parsons is the founder and CEO of Content Powered, a premier content marketing agency that leverages nearly two decades of his experience in content marketing to drive business growth. Renowned for founding and scaling multi-million dollar eCommerce businesses through strategic content marketing, James has become a trusted voice in the industry, sharing his insights in Search Engine Watch, Search Engine Journal, Forbes, Entrepreneur, Inc, and other leading publications. His background encompasses key roles across various agencies, contributing to the content strategies of major brands like eBay and Expedia. James's expertise spans SEO, conversion rate optimization, and effective content strategies, making him a pivotal figure in the industry.