I am trying to only see posts after or equal to today and sort ASC, my date field outputs Ymd, the first part (only see posts after or equal to today) works but the sorting does not.
$today = date ('Ymd');
$args = array(
'post_type' => 'diensten',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'datum_dienst',
'value' => $today,
'compare' => '>='
)
),
'meta_key' => 'datum_dienst',
'orderby' => 'meta_value_num',
'order' => 'ASC',
);
$loop = new WP_Query( $args );
For the few people facing the same problem, here is my very specific solution.
If you have the wordpress plugin Post Types Order installed it will override your order query, i uninstalled it and everything magically worked!