mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Global Styles: Fix PHP warning in WP_REST_Global_Styles_Controller if no styles exist.
There is a PHP warning in WP_REST_Global_Styles_Controller because we are assuming that every theme.json has styles property, which is not always the case. Props ntsekouras. Fixes #54900. Built from https://develop.svn.wordpress.org/trunk@52750 git-svn-id: http://core.svn.wordpress.org/trunk@52339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c70e24e0ab
commit
95bbd4c7d1
@ -563,7 +563,10 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
|
||||
}
|
||||
|
||||
if ( rest_is_field_included( 'styles', $fields ) ) {
|
||||
$data['styles'] = $theme->get_raw_data()['styles'];
|
||||
$raw_data = $theme->get_raw_data();
|
||||
if ( isset( $raw_data['styles'] ) ) {
|
||||
$data['styles'] = $raw_data['styles'];
|
||||
}
|
||||
}
|
||||
|
||||
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52749';
|
||||
$wp_version = '6.0-alpha-52750';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user