They all have a value, this snippet replace the existing value
if (get_field(‘date_de_debut’)) {
$query_array[‘meta_key’] = ‘date_de_debut’;
$query_array[‘orderby’] = ‘meta_value’;
}
I think this has to be with the post ID. But why is it working if I use this:
$query_array = array(
‘post_status’ => ‘publish’,
‘post_type’ => ‘show-item’,
‘posts_per_page’ => $params[‘number_of_items’],
‘orderby’ => ‘meta_value’,
‘meta_key’ => ‘date_de_debut’,
‘order’ => $params[‘order’]
);