diff --git a/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php b/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php index e9751238c85118..272c2fe8b76fba 100644 --- a/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php +++ b/lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php @@ -1903,9 +1903,11 @@ protected static function get_style_nodes( $theme_json, $selectors = array() ) { if ( isset( $theme_json['styles']['elements'] ) ) { foreach ( self::ELEMENTS as $element => $selector ) { - if ( ! isset( $theme_json['styles']['elements'][ $element ] ) ) { + if ( ! isset( $theme_json['styles']['elements'][ $element ] ) || ! array_key_exists( $element, static::ELEMENTS ) ) { continue; } + + // Handle element defaults. $nodes[] = array( 'path' => array( 'styles', 'elements', $element ), 'selector' => static::ELEMENTS[ $element ],