Sanitizes the run input by coercing it to the ability’s input schema.
Description
Registered as the input argument sanitize_callback so that both check_ability_permissions() and execute_ability() receive natively typed input regardless of transport.
See also
Parameters
$inputmixedrequired- Raw input extracted from the request.
$requestWP_REST_Requestrequired- The request object.
Source
public function sanitize_input_for_ability( $input, $request ) {
$ability = wp_has_ability( $request['name'] ) ? wp_get_ability( $request['name'] ) : null;
if ( ! $ability instanceof WP_Ability ) {
return $input;
}
return $this->coerce_input_to_schema( $input, $ability );
}
Changelog
| Version | Description |
|---|---|
| 7.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.