Home › Forums › General Issues › Querying multiple subfields of the same particular repeater row › Reply To: Querying multiple subfields of the same particular repeater row
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 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.