diff --git a/lib/compat/wordpress-6.6/compat.php b/lib/compat/wordpress-6.6/compat.php index e1a72342db957..4e444d3149824 100644 --- a/lib/compat/wordpress-6.6/compat.php +++ b/lib/compat/wordpress-6.6/compat.php @@ -15,6 +15,11 @@ function gutenberg_change_patterns_link_and_remove_template_parts_submenu_item() { if ( ! wp_is_block_theme() ) { global $submenu; + + if ( empty( $submenu['themes.php'] ) ) { + return; + } + foreach ( $submenu['themes.php'] as $key => $item ) { if ( 'edit.php?post_type=wp_block' === $item[2] ) { $submenu['themes.php'][ $key ][2] = 'site-editor.php?path=/patterns';