Support

Account

Home Forums General Issues Querying multiple subfields of the same particular repeater row Reply To: Querying multiple subfields of the same particular repeater row

  • Hi @charlesr @acf-support

    It seems that I have the same issue for one of my website.
    I have a repeater field : resultats
    I have three subfield : rank, country (a relation field), results.

    I want to query post when rank = 3 and country = country-single

    This is my code for querying post :

    $query_args = array(
        'post_type' => 'epreuves',
        'meta_query' => array(
            'relation' => 'AND',
            array(
                'key'       => 'resultats_%_country',
                'compare'   => 'LIKE',
                'value' =>  $global_ID
            ),
            array(
                'key'       => 'resultats_%_rank',
                'compare'   => 'LIKE',
                'value'     => 3,
            )  
        )
    );
    $query = new WP_Query( $query_args );

    It work fine, but if I have my country (france for exemple) in the rank 2 and an other country (USA) in the rank 3 he show me the post where france is in the rank 2.
    It looks like the meta_query don’t search in the row of the repeater but in all the repeater.

    I hope I am clear enough
    Thanks 🙂