Support

Account

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.