Custom sanitize callback used for all options to allow the use of ‘null’.
Description
By default, the schema of settings will throw an error if a value is set to null as it’s not a valid value for something like "type => string". We provide a wrapper sanitizer to allow the use of null.
Parameters
$valuemixedrequired- The value for the setting.
$requestWP_REST_Requestrequired- The request object.
$paramstringrequired- The parameter name.
Source
public function sanitize_callback( $value, $request, $param ) {
if ( is_null( $value ) ) {
return $value;
}
return rest_parse_request_arg( $value, $request, $param );
}
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.