From f9eb4065cbbebef444ce5f53e7ad708146a2501e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Thu, 1 Jul 2021 11:13:13 +0200 Subject: [PATCH] Cover against non existing styles (#33127) --- lib/global-styles.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/global-styles.php b/lib/global-styles.php index 10f10acb4d5a08..013fdb11190e5e 100644 --- a/lib/global-styles.php +++ b/lib/global-styles.php @@ -134,6 +134,12 @@ function_exists( 'gutenberg_is_edit_site_page' ) && '__experimentalNoWrapper' => true, ); + // Make sure the styles array exists. + // In some contexts, like the navigation editor, it doesn't. + if ( ! isset( $settings['styles'] ) ) { + $settings['styles'] = array(); + } + // Reset existing global styles. foreach ( $settings['styles'] as $key => $style ) { if ( isset( $style['__unstableType'] ) && 'globalStyles' === $style['__unstableType'] ) {