Title: WP_REST_Themes_Controller::get_items
Published: December 6, 2018
Last modified: February 24, 2026

---

# WP_REST_Themes_Controller::get_items( WP_REST_Request $request ): 󠀁[WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)󠁿|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#wp--skip-link--target)

Retrieves a collection of themes.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#parameters)󠁿

 `$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)
required

Full details about the request.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#return)󠁿

 [WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)
|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) Response
object on success, or [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
object on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#source)󠁿

    ```php
    public function get_items( $request ) {
    	$themes = array();

    	$active_themes = wp_get_themes();
    	$current_theme = wp_get_theme();
    	$status        = $request['status'];

    	foreach ( $active_themes as $theme ) {
    		$theme_status = ( $this->is_same_theme( $theme, $current_theme ) ) ? 'active' : 'inactive';
    		if ( is_array( $status ) && ! in_array( $theme_status, $status, true ) ) {
    			continue;
    		}

    		$prepared = $this->prepare_item_for_response( $theme, $request );
    		$themes[] = $this->prepare_response_for_collection( $prepared );
    	}

    	$response = rest_ensure_response( $themes );

    	$response->header( 'X-WP-Total', count( $themes ) );
    	$response->header( 'X-WP-TotalPages', 1 );

    	return $response;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php#L197)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php#L197-L220)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_REST_Themes_Controller::is_same_theme()](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/is_same_theme/)`wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php` |

Helper function to compare two themes.

  | 
| [WP_REST_Themes_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/prepare_item_for_response/)`wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php` |

Prepares a single theme output for response.

  | 
| [wp_get_themes()](https://developer.wordpress.org/reference/functions/wp_get_themes/)`wp-includes/theme.php` |

Returns an array of [WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/) objects based on the arguments.

  | 
| [rest_ensure_response()](https://developer.wordpress.org/reference/functions/rest_ensure_response/)`wp-includes/rest-api.php` |

Ensures a REST response is a response object (for consistency).

  | 
| [wp_get_theme()](https://developer.wordpress.org/reference/functions/wp_get_theme/)`wp-includes/theme.php` |

Gets a [WP_Theme](https://developer.wordpress.org/reference/classes/wp_theme/) object for a theme.

  |

[Show 2 more](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_themes_controller/get_items/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_themes_controller%2Fget_items%2F)
before being able to contribute a note or feedback.