WP_REST_Global_Styles_Controller::get_theme_items() WordPress Method
The WP_REST_Global_Styles_Controller::get_theme_items() method is used to get a list of all available themes. This method returns an array of theme objects, each containing a name, description, and screenshot.
WP_REST_Global_Styles_Controller::get_theme_items( WP_REST_Request $request ) #
Returns the given theme global styles variations.
Parameters
- $request
(WP_REST_Request)(Required)The request instance.
Return
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
public function get_theme_items( $request ) { if ( wp_get_theme()->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(); $response = rest_ensure_response( $variations ); return $response; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |