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>
<?php
wp_reset_postdata();
}
Related Posts:
- Keep featured content post in homepage with original order
- How to show related posts by category
- the_author() returns empty string
- Display all posts from specific categories on a page
- How to schedule multiple posts while adding new
- How to exclude latest x posts from a paginated query?
- Display content from a specific category
- How to display posts by current user/author in a custom page template?
- Number of posts per page setting is not working?
- WordPress Posts Out Of Order after 3.1 Update
- Query only Posts from Both of Two Category?
- Insert custom div between posts
- Order post by year DESC and month ASC
- WordPress get posts by date without query_posts
- How to Display Post View Count
- Featured Posts for Category Pages
- Cannot Update A Post, 404 Error
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- How would I get 1 latest post from a query for 5 posts?
- How to get the date of a post in WordPress, so I could use it in a script?
- Exclude posts with empty post_content in wp_query
- Improving WP_Query for performance when random posts are ordered
- Create dropdown list post
- I would like to give special promotion for the first 100 posts in my blog? Can anyone tell me how to do that?
- Automatically Updating Publish Date Bug
- Inserting custom data to the_post() during loop
- How To Get Posts With A Specific Word
- If modified on same day, show only time
- Why WP_Query(‘showposts=5’) shows only 1 post?
- is there a way to show the the post title after the image?
- Display all posts that were published before full post on single.php
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Random ajax load only works with posts_per_page set to -1
- Display an author’s posts on his own author page
- posts_per_page option limits the number of Gallery items
- How i can limit period of post publication?
- wp_posts table: safely remove unused columns to save database storage
- Display Posts on Custom Page
- Nested WP_Query breaking loop
- Counter is skipping post when I still want it visible [closed]
- Changing default WP-Site creation date
- Query for first 3 posts to change the look and feel
- Archive template combined with post slider and regular posts
- How to only publish posts with image in it
- wp_query with ajax
- How to give classname to post if post has no content?
- tribe_get_start_time displays the current date and time on other post types than tribe_events
- Custom posts listing widget always returns 1 extra result
- WordPress post filter menu
- Get postlist for each category using query_posts?
- How to save posts position on homepage after random function?
- WordPress query portfolio posts
- Date is wrong on ‘all posts’ page
- change the post time on multiple posts
- How to get posts ordered by using their categories?
- WP_Query articles order by offset in collumns
- Display 3 posts with different HTML markup using a loop
- Getting posts from some categories plus some individual posts
- How to assign a post to a post parrent?
- query for filtering published posts?
- get parent fields title, content excerpt etc
- Post navigation using date
- AWS usage queries
- Bulk update published posts date randomly using wp-cli?
- Pull in posts using post meta for REST API
- How to merge the content of posts that have the same title?
- How to fetch courses in all languages in WordPress?
- How to show post views shortcode data for each post on Posts List Page?
- How do you update post date (year only) in a separate custom field?
- How can I use query_posts to loop through posts and construct my own content?
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Show 5 posts and than 3 posts offset with pagination
- WP_Query to get posts in a specific tag or has post_format
- Make recent post display recent updated, instead of recent published
- Manipulate query to show specific post
- Querying posts from current category, using a variable as array argument
- Need help writing loop to display posts by categories in separate divs
- Sort / Filter Queries
- get_page_by_title() not working if special characters are present
- Modify WordPress loop after it has been run
- Query post category & remove any post id
- get “read more” with custom DB query like you would with WP Query
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How do I control the fallback query after the original query returned cero posts?
- Remove duplicated posts in the loop if post has more than one category
- Adding a category at even positions on main loop with modified pagination
- How to limit the number of results for all query_posts on mysite
- How to limit post query to only return a total count of items with certain post statuses?
- Not displaying any articles on a custom made file
- wp trim function not working
- Change from all posts to specific categories post on main page?
- Count words for all posts by all authors
- Word count for all posts of all authors
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Dynamic archive of posts by date
- Why does ‘get_the_ID’ work outside of the loop?