rest_parse_request_arg( mixed $value, WP_REST_Request $request, string $param )
Parse a request argument based on details registered to the route.
Description
Runs a validation check and sanitizes the value, primarily to be used via the sanitize_callback
arguments in the endpoint args registration.
Parameters
- $value
-
(mixed) (Required)
- $request
-
(WP_REST_Request) (Required)
- $param
-
(string) (Required)
Return
(mixed)
Source
File: wp-includes/rest-api.php
function rest_parse_request_arg( $value, $request, $param ) { $is_valid = rest_validate_request_arg( $value, $request, $param ); if ( is_wp_error( $is_valid ) ) { return $is_valid; } $value = rest_sanitize_request_arg( $value, $request, $param ); return $value; }
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_parse_request_arg