Home › Forums › Front-end Issues › ACF Checkbox Choices › Reply To: ACF Checkbox Choices
@julianmarcorpsa-com Have you tried dropping the underscore from the meta_key value…so just = 'mychoices'
. I ask because when I use a plugin called Search & Filter Pro, I have to select the meta key to pick which which field I want to filter by. In the list of available fields, each field shows up twice, one with a preceding underscore and one without. I have to use the one without in order for it to work correctly.
But if that’s not the case, you should be able to do something like:
<?php
$values = get_field('mychoices');
$field = get_field_object('mychoices');
$choices = $field['choices'];
?>
<ul>
<?php foreach( $choices as $choice => $label ) : ?>
<li>Value: <?php echo $choice; ?>, Label: <?php echo $label; ?></li>
<?php endforeach; ?>
</ul>
Let me know if that doesn’t work for you. I didn’t get a chance to test out, but I just did something similar the other day.
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.