Support

Account

Home Forums General Issues Display unmarked checkbox Reply To: Display unmarked checkbox

  • Hi @crishenrique1986 ,

    In order to show all the checkbox options including the not selected, the following code should help you out.

    $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 'marked';
        }
        echo '<br />';
    }

    I hope this helps.