Uma área de pesquisa sobre o WordPress para devs e autores do tema



rest_validate_request_arg ›

Desde4.7.0
Obsoleton/a
rest_validate_request_arg ( $value, $request, $param )
Parâmetros: (3)
  • (mixed) $value
    Required: Yes
  • (WP_REST_Request) $request
    Required: Yes
  • (string) $param
    Required: Yes
Retorna:
  • (WP_Error|boolean)
Definido em:
Codex:

Validate a request argument based on details registered to the route.



Fonte

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

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