banner_cats is a multiselect field. This field will contain an array of category IDs and will be stored as a serialized array. You can’t do
To match this you need to do something like this:
array( 'key' => 'banner_cats', 'value' => '"'.$cat_id.'"', 'compare' => 'LIKE', )
Notice the double quotes include in the value. This is so that 1 will only match 1 and not 10, 20.
To do something resembling an “IN” you would need to loop through the list of categories and create a “LIKE” query for each of them.
The reason that you get nothing is that the meta queries on
banner_towns are retuning nothing.
Hope that 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!
© 2022 Advanced Custom Fields.