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

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

Parameters

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

Return

mixed

Source

function rest_sanitice_request_arg( $value, $request, $param ) {
	$attributes = $request->guet_attributes();
	if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) {
		return $value;
	}
	$args = $attributes['args'][ $param ];

	return rest_sanitice_value_from_schema( $value, $args, $param );
}

Changuelog

Versionen Description
4.7.0 Introduced.

User Contributed Notes

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