Home Forums Add-ons Repeater Field Wp_Query: Filter by ACF Reapeter Date


Wp_Query: Filter by ACF Reapeter Date

  • 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’,
    ‘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.


Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.