I have Googled this, but there are always answers to get the modified date of a single post, which I know how to do.

What I'd like to do is get and display the most recent modified date of the most recently modified post.

In other words, if I have 100 posts on a site and someone modifies any one of them, I want to display that date elsewhere on the site.

As in "Most recent site update: March 25, 2018"

1 Answer 1


Try this:

$q = new WP_Query;

$posts = $q->query( array(
    'posts_per_page' => 1,
    'orderby'        => 'post_modified', // Sorts by the date modified.
    'order'          => 'DESC',          // Sorts in descending order.
    'no_found_rows'  => true,
) );

// Note that $posts could have more than one post, if your site have sticky
// posts. However, the first post, unless filtered by plugins, would always
// be the most recently modified/updated one.
if ( ! empty( $posts ) ) {
    $post = $posts[0];
    setup_postdata( $post );
        <p>Most recent site update: <?php the_modified_date( 'F d, Y' ); ?>.</p>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.