In your meta query you also need explicitly query posts that don’t have that meta key set. You can do this by nesting meta queries like so:
'orderby' => array(
'meta_value_num' => 'ASC',
'menu_order' => 'ASC'
),
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'OR',
array(
'key' => 'newprice',
'type' => 'decimal',
),
array(
'key' => 'newprice',
'value' => '',
'compare' => 'NOT EXISTS',
),
),
array(
'key' => 'datum',
'compare' => '>=',
'value' => strtotime('-1days'),
),
),
Also note that you need to set 'meta_key'
on the query so that when you orderby
'meta_value_num'
it orders by the right meta key.
Actually, it doesn’t seem to be necessary if you have a meta_query
, and excluding it will save you a join.