WP_REST_Global_Styles_Controller::get_theme_items() – Returns the given theme global styles variations.

You appear to be a bot. Output may be restricted

Description

Returns the given theme global styles variations.

Usage

$WP_REST_Response|WP_Error = WP_REST_Global_Styles_Controller::get_theme_items( $request );

Parameters

$request
( WP_REST_Request ) required – The request instance.

Returns

WP_REST_Response|WP_Error

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php


Lines:

1 to 16 of 16
  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;
  }
 

 View on GitHub View on Trac