diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php index 94b3e5c264..472e8dc12c 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php @@ -197,18 +197,22 @@ class WP_REST_Themes_Controller extends WP_REST_Controller { 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 ); + if ( array( 'active' ) === $status ) { + $prepared = $this->prepare_item_for_response( $current_theme, $request ); $themes[] = $this->prepare_response_for_collection( $prepared ); + } else { + foreach ( wp_get_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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 50b07fe05b..a9fc3cf5d6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '7.0-beta3-61855'; +$wp_version = '7.0-beta3-61856'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.