It’s working well with the IF condition so this is not the problem 🙂 The problem is that the variable is always empty even if I ise get_field() or the_field() 🙂
If I use this code like this (without the if) it’s ordering like a charm !
$query_array = array(
‘post_status’ => ‘publish’,
‘post_type’ => ‘show-item’,
‘posts_per_page’ => $params[‘number_of_items’],
‘orderby’ => $params[‘orderby’],
‘order’ => $params[‘order’]
);
$query_array[‘meta_key’] = ‘date_de_debut’;
$query_array[‘orderby’] = ‘meta_value’;