)

How to Display the Last Updated Date of Your WP Posts/Pages

Last Updated: 3 years ago by BrodNeil

There are different methods to display the last updated date on your posts:

  • functions.php
  • Themes templates (like single.php, archive.php, and other templates)
  • WP plugin

Check out the full article at of my favorite WP tutorial sites: https://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpress/

In this post, we’ve decided to go for the first method above, and that is via the functions.php.

You will need to add this code to your theme’s functions.php:

function wpb_last_updated_date( $content ) {
$u_time = get_the_time('U'); 
$u_modified_time = get_the_modified_time('U'); 
if ($u_modified_time >= $u_time + 86400) { 
$updated_date = get_the_modified_time('F jS, Y');
$updated_time = get_the_modified_time('h:i a'); 
$custom_content .= '<p class="last-updated">Last updated on '. $updated_date . ' at '. $updated_time .'</p>';  
} 
 
    $custom_content .= $content;
    return $custom_content;
}
add_filter( 'the_content', 'wpb_last_updated_date' );

Add custom CSS to style the appearance. Use this CSS as your starting point:

.last-updated {
    font-size: small;
    text-transform: uppercase;
    background-color: #fffdd4;
} 

Source: https://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpress/

WP Plugin

If you prefer a WP plugin, you can use this plugin: WP Last Modified Info. Using this plugin is pretty straightforward.

Recommendations

  • BrandPush - gets you featured on 200+ news sites. Go viral with massive exposure through the likes of Daily Herald, Fox40, Digital Journal, Benzinga, The Chronicle Journal, NewsMax, AP, and even through Bloomberg and MSN.
  • SimpleTraffic - drives real visitors to your website, blog, or affiliate link. Get started with 2500 free visitors on your 5 day free trial!
  • MediaServe - is a web hosting service that values free speech, providing content policies and support aligned with these values. It is also known as the web hosting for conservatives.
  • Leaver - is a web hosting service tailored for conservatives, providing content policies and support aligned with conservative values --- conservative web hosting.
  • Fokas Beyond: Stock Market Course - Click to watch the masterclass. Register Now for FREE!

Discover more tools - See our recommended tools, software, and services.

Recommendations

  • SimpleTraffic - drives real visitors to your website, blog, or affiliate link. Get started with 2500 free visitors on your 5 day free trial!
  • BrandPush - gets you featured on 200+ news sites. Go viral with massive exposure like Daily Herald, Newsmax, Fox News, etc.!
  • MediaServe - is a web hosting service that values free speech, providing content policies and support aligned with these values. It is also known as the web hosting for conservatives.
  • Leaver - is a web hosting service tailored for conservatives, providing content policies and support aligned with conservative values --- conservative web hosting.
  • Nitropack - Unleash lightning-fast website performance like never before! Get your FREE account now!
  • RankMath - the SEO plugin you should try for easy and practical use
  • WordHero.co - Effortlessly produce AI-enhanced content with a single click.
  • Fokas Beyond: Stock Market Course - Click to watch the masterclass. Register Now for FREE!
  • Creately - replaces your Visual Collaboration, Whiteboarding, Diagramming tools with more power and capability. Try the FREE plan!
  • Copymatic.ai - Instantly produce compelling copy and stunning images
  • ContentatScale.ai - Publish high-ranking content… instantly.
  • Catering Services in Cebu - Food catering services provider in Cebu Philippines.
  • Ngohiong - order now at P150 (around $3) per pack of 10 pieces.

Discover more tools - See our recommended tools, software, and services.