WP_REST_Global_Styles_Controller::get_theme_items( WP_REST_Request $request ): WP_REST_Response|WP_Error

Returns the given theme global styles variations.


Parameters

$request WP_REST_Request Required
The request instance.

Top ↑

Return

WP_REST_Response|WP_Error


Top ↑

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php. View all references

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;
}


Top ↑

Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.