Home › Forums › General Issues › Query with Relationship field › Reply To: Query with Relationship field
Hi @mclambert
I’m afraid you need to use multiple ‘meta_query’ values like this:
$meta_query = array('relation' => 'AND');
foreach( $offres_id as $the_id ) {
$meta_query[] = array(
'key' => 'offre_liee',
'value' => '"' . $the_id . '"',
'compare' => 'LIKE'
);
}
Then you can use it like this:
'meta_query' => $meta_query,
This will create the query for all of the IDs you get. Unfortunately, I’m not sure regarding the performance if you have a lot of IDs.
I hope this helps 🙂
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.