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 get posts published between a date and today?
- 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
- order posts by date like craigslist
- 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?
- post_name empty after wp_insert_post
- Query posts distinct authors
- How to get previous 10 days post from a specific date – WP Query
- 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
- Can’t show comments count per post outside loop
- Only display posts with comments
- Order post by year DESC and month ASC
- WordPress get posts by date without query_posts
- How to Display Post View Count
- Different amount of posts on homepage than paged pages
- Featured Posts for Category Pages
- How to get the latest posting time of archived pages in WordPress?
- Cannot Update A Post, 404 Error
- Function to show random posts from a category
- How to insert current date/time in the content of a post?
- Hiding posts in a list from specified categories
- How would I get 1 latest post from a query for 5 posts?
- Filter Posts By Tag
- How to get the date of a post in WordPress, so I could use it in a script?
- Can I set and show “important” post in my blog?
- 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?
- previewing my posts on static page?
- Exclude newest post from category X but show rest
- Reset Popular post query?
- Automatically Updating Publish Date Bug
- Inserting custom data to the_post() during loop
- How To Get Posts With A Specific Word
- How can I show many posts an author has per week?
- 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?
- How to display particular categorie’s post which associated to specific user?
- 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 args with relation
- 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
- How to correctly escape data
- Use special template for the first post in the loop
- Blog posts not displaying on blog posts page
- Repeating post how to solve this
- Sort Events by Venue Title – Sort Post set by related post ids
- Need help writing loop to display posts by categories in separate divs
- Get posts by category or author
- 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
- show latest authors blog post
- get “read more” with custom DB query like you would with WP Query
- How to get only current images of a post
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- 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
- How to pass multiple checkbox values to wordpress query?
- 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 get all post titles starting with numbers and symbols?
- How to inject a post within a loop
- How to get alphabetic listing x other posts, based on first letter post?
- wp_query select if have comments
- Creating pages and getting their values from the database table
- How to limit post query to only return a total count of items with certain post statuses?
- How to handle dates, trying to calculate time since a post
- 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?
- query_posts different amount of posts per page [duplicate]
- 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
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to change url of posts?
- date_query returning only the most recent post instead of the post published before today
- What might cause two dates to appear on a blog post?
- How to show related posts by detecting the current category?
- Display posts on a custom page from only a specific category?
- Why does ‘get_the_ID’ work outside of the loop?
- WordPress Post Query Using Custom native MySQL like St_Distance_Sphere