diff --git a/includes/fields/class-acf-field-true_false.php b/includes/fields/class-acf-field-true_false.php index ba411e65..6c836143 100644 --- a/includes/fields/class-acf-field-true_false.php +++ b/includes/fields/class-acf-field-true_false.php @@ -67,6 +67,14 @@ function render_field( $field ) { 'value' => 0, ); + if (!empty($field['readonly']) || !empty($field['disabled'])) { + $input['disabled'] = 'disabled'; + unset($input['name']); + + // if the field meant to be disabled, the element not mutable, focusable, or even submitted with the form. + $hidden['value'] = !empty($field['readonly']) && empty($field['disabled']) ? $field['value'] : 0; + } + $active = $field['value'] ? true : false; $switch = '';