[Resolved] Sort WP_Query by Date and Time field, but only include results that haven't past
In my query I currently have:
$recent_events = new WP_Query(array('post_type' => 'phelps_event', 'posts_per_page' => 3, 'orderby' => 'meta_value', 'meta_key' => '_simple_fields_fieldGroupID_4_fieldID_1_numInSet_0', 'meta_value' => time(), 'meta_compare' => '>=', 'order' => 'ASC'))
My goal is to get the closest 3 events to today, including today, but exclude any events that may have passed. I’m currently using the new Date and Time field, but am not sure what to put in as my ‘meta_value’. I suspect it requires a specific time format?
Thanks for looking!
- The topic ‘[Resolved] Sort WP_Query by Date and Time field, but only include results that haven't past’ is closed to new replies.