Home › Forums › General Issues › Query custom post based on user selections › Reply To: Query custom post based on user selections
Checkboxes are a bit more difficult to search because the values are stored as serialized arrays. The query would look something like
$args = array(
'post_type' => 'salesperson',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'country',
'value' => '"'.$country.'"',
'compare' = 'LIKE'
),
array(
'key' => 'state',
'value' => '"'.$state.'"',
'compare' = 'LIKE'
),
array(
'key' => 'industry',
'value' => '"'.$industry.'"',
'compare' = 'LIKE'
)
)
);
$query = new WP Query($args);
there is more information here http://www.advancedcustomfields.com/resources/checkbox/
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!
In this article, we take a close look at WordPress custom fields and compare them to the custom fields possible with ACF: https://t.co/hk3yibkHyk
— Advanced Custom Fields (@wp_acf) July 14, 2022
© 2022 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.