Hi,
I was on the same problem today and I find a solution. I paste it here with your variables names :
// filter
function my_posts_where( $where ) {
$where = str_replace("meta_key = 'date_formation_$", "meta_key LIKE 'date_formation_%", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
// find todays date
$date = date('Ymd');
// args
$args = array(
'numberposts' => -1,
'post_type' => 'product',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'date_formation_$_date_session',
'compare' => '>=',
'value' => $date,
),
array(
'key' => 'date_formation_$_date_session',
'compare' => '>=',
'value' => $date,
)
)
);
$the_query = new WP_Query( $args );
And then, I work on my results for ordering.