Home › Forums › General Issues › How to create meta_query with relationship field and comparator 'IN'? › Reply To: How to create meta_query with relationship field and comparator 'IN'?
You cannot to an “IN” query on a relationship field.
see section 3 of this doc https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
You need to do
$meta_query = array(
'relation' => 'OR',
array(
'key' => 'field_name',
'value' => '"'.$first_id.'"',
'compare' => 'LIKE'
),
array(
'key' => 'field_name',
'value' => '"'.$second_id.'"',
'compare' => 'LIKE'
),
// etc..
);
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.