Uses
Uses | Description |
---|---|
wp-includes/rest-api.php: rest_parse_request_arg() | Parse a request argument based on details registered to the route. |
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
.
(mixed) (Required) The value for the setting.
(WP_REST_Request) (Required) The request object.
(string) (Required) The parameter name.
(mixed|WP_Error)
File: wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
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–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_settings_controller/sanitize_callback