WP_REST_Global_Styles_Controller::get_theme_items()
Returns the given theme global styles variations.
Method of the class: WP_REST_Global_Styles_Controller{}
No Hooks.
Return
WP_REST_Response|WP_Error
.
Usage
$WP_REST_Global_Styles_Controller = new WP_REST_Global_Styles_Controller(); $WP_REST_Global_Styles_Controller->get_theme_items( $request );
- $request(WP_REST_Request) (required)
- The request instance.
Changelog
Since 6.0.0 | Introduced. |
Since 6.2.0 | Returns parent theme variations, if they exist. |
WP_REST_Global_Styles_Controller::get_theme_items() WP REST Global Styles Controller::get theme items code WP 6.5.2
public function get_theme_items( $request ) { if ( get_stylesheet() !== $request['stylesheet'] ) { // This endpoint only supports the active theme for now. return new WP_Error( 'rest_theme_not_found', __( 'Theme not found.' ), array( 'status' => 404 ) ); } $variations = WP_Theme_JSON_Resolver::get_style_variations(); return rest_ensure_response( $variations ); }