Home › Forums › ACF PRO › Using compare IN operator for meta_query › Reply To: Using compare IN operator for meta_query
You cannot use “IN” and must use “LIKE” as @acf-fan says and you need to have a nested query and do multiple “LIKE”s
'meta_query' => array
array(
'relation' => 'OR',
array(
'key' => 'your-field',
'value' => 'value 1',
'compare' => 'LIKE'
),
array(
'key' => 'your-field',
'value' => 'value 2',
'compare' => 'LIKE'
),
array(
'key' => 'your-field',
'value' => 'value 3',
'compare' => 'LIKE'
),
)
)
This can be costly to performance and it the list you are looking for is too long could even time out your site. This old post is about repeaters but it also applies in cases where ACF stores values as serialized arrays https://web.archive.org/web/20190814230622/https://acfextras.com/dont-query-repeaters/
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.