Home › Forums › Backend Issues (wp-admin) › How i get the checkbox list by database? › Reply To: How i get the checkbox list by database?
Hi @zinzoz
I’m afraid that I can’t see the image you have uploaded. Could you please upload it to a third-party service like Dropbox?
Regarding your question, did you mean you want to dynamically show the checkboxes? If you did, you could check this page: http://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/.
If you want to create a list of checked options, you can use something like this:
$values = get_field('checkbox_field_name');
$field = get_field_object('checkbox_field_name');
$choices = $field['choices'];
foreach ($choices as $value => $label) {
echo $label,': ';
if (in_array($value, $values)) {
echo 'checked';
}
echo '<br />';
}
If those are not the thing you want, could you please explain it to me again in more detail. Don’t forget to provide me with some screenshots 🙂
I hope this 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!
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.