Hi all,
I’m trying to filter with WP_Query custom post “courses” base of dates of repeater field.
My repeater is called “dates” and contains three subfields:
– date
– Start time
– End time
I have added this snippet of code on my functions.php:
function my_posts_where( $where ) {
$where = str_replace(“meta_key = ‘dates%”, “meta_key LIKE ‘dates%”, $where);
return $where;
}
add_filter(‘posts_where’, ‘my_posts_where’);
$args = array(
‘post_type’ => ‘webinar’,
‘posts_per_page’ => -1,
// ‘post__not_in’ => array(get_the_ID()),
‘order’ => ‘ASC’,
‘orderby’ => ‘menu_order’,
‘meta_query’ => array(
‘relation’ => ‘AND’,
array(
‘key’ => ‘dates%date’,
‘compare’ => ‘>=’,
‘value’ => date(‘Ymd’),
)
)
);
I need to select posts that have at least one of date inside the repeater
after today’s date.
Thanks