As stated in the documentation: (bold formatting was added by me)
Note that meta_query expects nested arrays, even if you only have
one query.
So your meta query should actually look like the following, and note that in a meta_query
, we don’t use the meta_
prefix, e.g. we use just key
and not meta_key
:
$query_args['meta_query'] = array(
array( // clause/query 1
'key' => 'expire_date',
'value' => date("Y-m-d"),
'type' => 'DATE',
'compare' => '>=',
)
);
Or use the root meta_xxx
arguments instead, and note that I used meta_type
instead of just type
:
$query_args['meta_key'] = 'expire_date';
$query_args['meta_value'] = date("Y-m-d");
$query_args['meta_type'] = 'DATE';
$query_args['meta_compare'] = '>=';
Or did you actually mean to use $query_args['meta_query'][]
(note the []
), i.e. to add another clause to the existing meta_query
array? But even so, make sure you use the correct array keys.