mirror of
git://develop.git.wordpress.org/
synced 2025-03-23 21:39:50 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@52750 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9a6179e941
commit
d2b385b7b8
@ -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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user