Home › Forums › General Issues › Creating WP query with meta_query on array › Reply To: Creating WP query with meta_query on array
Hello!
I got exactly the same problem while user “in” operator in meta_query with an array.
After 2 hours of research I found the solution!
The key “value” as to be “values” (with a S at the end) and the operator “IN” is going to work.
WORK:
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'centers',
'values' => $centres,
'compare' => 'in',
)
)
DOESN’T WORK
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'centers',
'value' => $centres,
'compare' => 'in',
)
)
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.