Handle select options in setting sanitization function.
This commit is contained in:
parent
24014a5d04
commit
9d9d318727
|
@ -87,6 +87,11 @@ class WC_REST_Settings_API_Controller extends WC_REST_Controller {
|
||||||
$value['crop'] = $setting['default']['crop'];
|
$value['crop'] = $setting['default']['crop'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'select':
|
||||||
|
$options = array_keys( $setting['options'] );
|
||||||
|
$default = ( empty( $setting['default'] ) ? $options[0] : $setting['default'] );
|
||||||
|
$value = in_array( $raw_value, $options ) ? $raw_value : $default;
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
$value = wc_clean( $raw_value );
|
$value = wc_clean( $raw_value );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue