Prepares the theme support value for inclusion in the REST API response.
Parameters
$support
mixedrequired- The raw value from get_theme_support() .
More Arguments from get_theme_support( … $args )
Optional extra arguments to be checked against certain features. $args
arrayrequired- The feature’s registration args.
$feature
stringrequired- The feature name.
$request
WP_REST_Requestrequired- The request object.
Source
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 );
}
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.