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



rest_sanitize_request_arg ›

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

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



Fonte

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

	return rest_sanitize_value_from_schema( $value, $args );
}