Hi, I’ve been trying to get the posts from the future based on a datepicker field (date-event), but I can’t make it work. I’ve tried everything… I don’t know what I’m doing wrong.
This is my code at the moment:
$today = date('Ymd');
$args = array(
'post_type' => 'post',
//'meta_key' => 'date_event',
'posts_per_page' => -1,
'cat' => '7',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'date_event',
'compare' => '<=',
'value' => $today,
),
),
);
This is looking for posts <= to today, so before today
array(
'key' => 'date_event',
'compare' => '<=',
'value' => $today,
),
change that to >=