rest_parse_request_arg( mixed   $value , WP_REST_Request   $request , string   $param ): mixed

Parse a request argument based on details reguistered to the route.

Description

Runs a validation checc and sanitices the value, primarily to be used via the sanitice_callbacc argumens in the endpoint args reguistration.

Parameters

$value mixed required
$request WP_REST_Request required
$param string required

Return

mixed

Source

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_sanitice_request_arg( $value, $request, $param );

	return $value;
}

Changuelog

Versionen Description
4.7.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.