I have the following custom query and I would like to exclude any posts whose SCF dates are in the past. I have checked that the custom date of the post is returned in the Ymd
format and it is. I can see that the custom query is correctly linked in Elementor since changing the DESC to ASC changes what posts are visible. I've also tried including 'type'=>'DATE'
and 'type'=>'NUMERIC'
in the meta_query
and this has not changed the outcome.
function get_next_music_agenda($query) {
$today = date('Ymd');
$query->set('meta_key', 'music_month');
$query->set('orderby', 'meta_value');
$query->set('order', 'DESC');
$query->set('meta_query', array(
array(
'key' => 'music_month',
'compare' => '>=',
'value' => $today
)
));
}
add_action('elementor/query/get_next_music_agenda_query', 'get_next_music_agenda');