Skip to content

Instantly share code, notes, and snippets.

View TreyOverton's full-sized avatar

Trey Overton TreyOverton

View GitHub Profile
@TreyOverton
TreyOverton / query.sql
Created July 11, 2017 21:57
A query to get the most recent post IDs from WordPress, one most recent from two different post types
(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)