WP_REST_Themes_Controller::get_items( WP_REST_Request $request )
Retrieves a collection of themes.
Description Description
Parameters Parameters
- $request
-
(WP_REST_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; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |