Home › Forums › General Issues › Count posts by checked value (checkbox) › Reply To: Count posts by checked value (checkbox)
So you want to count posts that have a field named ‘aangeboden_door’ with several different values? I think you’ll have to modify the function so as to add meta_value as an array (of values) and setting ‘compare’ => ‘IN’. Try something like this:
// ...
if ( $meta_key && $meta_value ) {
if ( is_array($meta_value) ) {
$args['meta_query'][] = array('key' => $meta_key, 'value' => $meta_value, 'compare' => 'IN');
}
else {
$args['meta_query'][] = array('key' => $meta_key, 'value' => $meta_value);
}
}
// ...
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!
🚀 ACF & ACF PRO 6.0.7 are now available.
— Advanced Custom Fields (@wp_acf) January 18, 2023
✨This release contains bug fixes and improvements while we continue to work on the next major release of ACF.https://t.co/wQgAOpwmUI
© 2023 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.