I want to only get posts with current or future dates, to show upcoming events.
Current arguments:
$args = array(
'post_type' => 'event',
'meta_key' => 'event_start_date',
'orderby' => 'meta_value',
'order' => 'ASC'
);
This returns all the posts, including past events.
I read about post_status
but it did not seem to work. I tried 'post_status' => 'future'
without success.
2 Answers
adding the following arguments did the trick
'meta_value' => date('Y-m-d h:i'),
'meta_compare' => '>',