I am trying to sort a query to display posts in order of a meta_key value. The value is stored like so: 2018-Mar-23
.
I would like to display posts with a date that is after today, with the closest date for example 2018-Aug-30
being shown first, and the furthest date away 2020-Aug-30
to show last.
I have put a query together, which still mixes all dates up. Here is what i have:
$args = array(
'posts_per_page' => -1,
'post_type' => 'games' ,
'orderby' => 'meta_value_num',
'order' => 'ASC',
'post_parent' => 0,
'meta_query' => array(
array(
'key' => 'releasedate',
'value' => date("Y-M-d"),
'type' => 'DATE',
'compare' => 'BETWEEN',
)
)
);
For some reason i can only get this query to work using the compare method "BETWEEN"
. Using ">"
which i would expect to use, returns no results.
Any ideas?
Thanks