Summery Summery
Retrieves a collection of themes.
Syntax Syntax
Parameters Parameters
- $request
-
(Required) Full details about the request.
Return Return
(WP_REST_Response|WP_Error) Response object on success, or WP_Error object on failure.
Source Source
File: wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
public function get_items( $request ) {
// Retrieve the list of registered collection query parameters.
$registered = $this->get_collection_params();
$themes = array();
if ( isset( $registered['status'], $request['status'] ) && in_array( 'active', $request['status'], true ) ) {
$active_theme = wp_get_theme();
$active_theme = $this->prepare_item_for_response( $active_theme, $request );
$themes[] = $this->prepare_response_for_collection( $active_theme );
}
$response = rest_ensure_response( $themes );
$response->header( 'X-WP-Total', count( $themes ) );
$response->header( 'X-WP-TotalPages', count( $themes ) );
return $response;
}
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |