Convert allowed options to string values for comparison, html options have no data type distiction.
This commit is contained in:
parent
30398a65f1
commit
89d21a50a4
|
@ -727,13 +727,13 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
|||
}
|
||||
break;
|
||||
case 'select':
|
||||
$allowed_values = empty( $option['options'] ) ? array() : array_keys( $option['options'] );
|
||||
$allowed_values = empty( $option['options'] ) ? array() : array_map( 'strval', array_keys( $option['options'] ) );
|
||||
if ( empty( $option['default'] ) && empty( $allowed_values ) ) {
|
||||
$value = null;
|
||||
break;
|
||||
}
|
||||
$default = ( empty( $option['default'] ) ? $allowed_values[0] : $option['default'] );
|
||||
$value = in_array( $raw_value, $allowed_values ) ? $raw_value : $default;
|
||||
$value = in_array( $raw_value, $allowed_values, true ) ? $raw_value : $default;
|
||||
break;
|
||||
default:
|
||||
$value = wc_clean( $raw_value );
|
||||
|
|
Loading…
Reference in New Issue