WordPress at Your Fingertips
function is not described

WP_REST_Themes_Controller::get_item() public WP 5.7.0

Retrieves a single theme.

{} It's a method of the class: WP_REST_Themes_Controller{}

No Hooks.

Return

WP_REST_Response|WP_Error. Response object on success, or WP_Error object on failure.

Usage

$WP_REST_Themes_Controller = new WP_REST_Themes_Controller();
$WP_REST_Themes_Controller->get_item( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Changelog

Since 5.7.0 Introduced.

Code of WP_REST_Themes_Controller::get_item() WP 5.7.2

<?php
public function get_item( $request ) {
	$wp_theme = wp_get_theme( $request['stylesheet'] );
	if ( ! $wp_theme->exists() ) {
		return new WP_Error(
			'rest_theme_not_found',
			__( 'Theme not found.' ),
			array( 'status' => 404 )
		);
	}
	$data = $this->prepare_item_for_response( $wp_theme, $request );

	return rest_ensure_response( $data );
}