Fixed checkboxes in the admin settings

This allow set yes/no or null/1 for checkboxes

cc @mikejolley @jeffstieler
This commit is contained in:
Claudio Sanches 2016-07-27 17:52:11 -03:00
parent 83d25ed035
commit a5ba8a05ed
1 changed files with 1 additions and 1 deletions

View File

@ -697,7 +697,7 @@ class WC_Admin_Settings {
// Format the value based on option type.
switch ( $option['type'] ) {
case 'checkbox' :
$value = in_array( $raw_value, array( 'yes', 'no' ) ) ? $raw_value : 'no';
$value = '1' === $raw_value || 'yes' === $raw_value ? 'yes' : 'no';
break;
case 'textarea' :
$value = wp_kses_post( trim( $raw_value ) );