Uses
| Uses | Description |
|---|---|
| wp-includes/rest-api.php: rest_sanitize_value_from_schema() | Sanitize a value based on a schema. |
Prepares the theme support value for inclusion in the REST API response.
(mixed) (Required) The raw value from get_theme_support().
(array) (Required) The feature's registration args.
(string) (Required) The feature name.
(WP_REST_Request) (Required) The request object.
(mixed) The prepared support value.
File: wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
protected function prepare_theme_support( $support, $args, $feature, $request ) {
$schema = $args['show_in_rest']['schema'];
if ( 'boolean' === $schema['type'] ) {
return true;
}
if ( is_array( $support ) && ! $args['variadic'] ) {
$support = $support[0];
}
return rest_sanitize_value_from_schema( $support, $schema );
} | Version | Description |
|---|---|
| 5.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/prepare_theme_support