Family Encyclopedia >> Electronics

How to Display the Last Updated Date on Your WordPress Posts (Expert Guide)

Want to show visitors when you last updated your WordPress posts? Many sites, including ours at WPBeginner, regularly refresh older articles with new info, fixes, or media. Displaying the last updated date builds trust and keeps users informed. In this step-by-step guide, we'll show you proven methods to add it easily.

How to Display the Last Updated Date on Your WordPress Posts (Expert Guide)

Why Display the Last Updated Date on WordPress Posts?

Most WordPress themes show only the original publish date, which works for static blogs. But for dynamic sites—like news outlets or guides that evolve—it’s essential to highlight updates.

News sites often revisit stories with fresh developments. Without the last updated timestamp, readers miss key changes. Popular blogs sometimes omit dates entirely, but that's a mistake: transparency boosts credibility and SEO.

Ready to implement? Let's dive in. These methods are battle-tested on thousands of sites.

Video Walkthrough

Subscribe to WPBeginner’s YouTube Channel for more tutorials. If you prefer reading or need details, keep going.

How to Display the Last Updated Date in WordPress

This requires adding code to your theme's functions.php file or a site-specific plugin. New to this? See our beginner's guide on how to copy and paste code safely in WordPress.

Method 1: Show Last Updated Date Before Post Content

Add this code to your theme's functions.php or a custom plugin:

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;
    }
    return $content;
}
add_filter( 'the_content', 'wpb_last_updated_date' );

This snippet compares publish and modified times. If updated over 24 hours ago, it prepends the info before content.

Style it with custom CSS:

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

How to Display the Last Updated Date on Your WordPress Posts (Expert Guide)

Method 2: Add Last Updated Date in Theme Templates

For template edits, locate date-display code in single.php, archive.php, or content parts. Replace or append this:

$u_time = get_the_time( 'U' );
$u_modified_time = get_the_modified_time( 'U' );
if ( $u_modified_time >= $u_time + 86400 ) {
    echo '<p>Last updated on ';
    the_modified_time( 'F jS, Y' );
    echo ' at ';
    the_modified_time();
    echo '</p>';
}

How to Display the Last Updated Date on Your WordPress Posts (Expert Guide)

We hope this helped you add last updated dates to your WordPress site. For more efficiency, check our list of the most useful WordPress keyboard shortcuts.

Liked this? Subscribe to our YouTube Channel, follow us on Twitter and Facebook.