Created
July 11, 2017 21:57
-
-
Save TreyOverton/0311d7925654f19f6664b27f9891af0e to your computer and use it in GitHub Desktop.
A query to get the most recent post IDs from WordPress, one most recent from two different post types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(select ID, max(post_date) as max_post_date, post_type from wp_posts where post_type = 'post' and post_status='publish' group by id order by max_post_date desc limit 1) | |
union | |
(select ID, max(post_date) as max_post_date, post_type from wp_posts where post_type = 'event' and post_status='publish' group by id order by max_post_date desc limit 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment