Custom sanitize callback used for all options to allow the use of ‘null’.
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.
$valuemixedrequired
$requestWP_REST_Requestrequired
$paramstringrequired
public function sanitize_callback( $value, $request, $param ) {
if ( is_null( $value ) ) {
return $value;
}
return rest_parse_request_arg( $value, $request, $param );
}
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_settings_controller/sanitize_callback