diff --git a/lib/compat/wordpress-5.9/class-wp-rest-global-styles-controller.php b/lib/compat/wordpress-5.9/class-wp-rest-global-styles-controller.php index e4171c7eb0872..755b324257d29 100644 --- a/lib/compat/wordpress-5.9/class-wp-rest-global-styles-controller.php +++ b/lib/compat/wordpress-5.9/class-wp-rest-global-styles-controller.php @@ -564,8 +564,10 @@ public function get_theme_item( $request ) { } if ( rest_is_field_included( 'styles', $fields ) ) { - $raw_data = $theme->get_raw_data(); - $data['styles'] = isset( $raw_data['styles'] ) ? $raw_data['styles'] : array(); + $raw_data = $theme->get_raw_data(); + if ( isset( $raw_data['styles'] ) ) { + $data['styles'] = $raw_data['styles']; + } } $context = ! empty( $request['context'] ) ? $request['context'] : 'view';