Show The "Last Modified" Updated Date in WordPress

Updated 02/02/2024, Posted 02/02/2024 by James Parsons James Parsons 0 Comments

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 Snippets

Written by James Parsons

Hi, I'm James Parsons! I founded Content Powered, a content marketing agency where I partner with businesses to help them grow through strategic content. With nearly twenty years of SEO and content marketing experience, I've had the joy of helping companies connect with their audiences in meaningful ways. I started my journey by building and growing several successful eCommerce companies solely through content marketing, and I love to share what I've learned along the way. You'll find my thoughts and insights in publications like Search Engine Watch, Search Engine Journal, Forbes, Entrepreneur, and Inc, among others. I've been fortunate to work with wonderful clients ranging from growing businesses to Fortune 500 companies like eBay and Expedia, and helping them shape their content strategies. My focus is on creating optimized content that resonates and converts. I'd love to connect – the best way to contact me is by scheduling a call or by email.