From c9a8d9c4e151b7874f146d6665a00d4e6556cbd3 Mon Sep 17 00:00:00 2001 From: JustinyAhin Date: Mon, 3 May 2021 08:33:57 +0100 Subject: [PATCH 1/3] Remove widget screen empty link in admin --- lib/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.php b/lib/init.php index 880fe852c6fad..c1240dfab11d5 100644 --- a/lib/init.php +++ b/lib/init.php @@ -113,7 +113,7 @@ function gutenberg_site_editor_menu() { * @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API. */ function modify_admin_bar( $wp_admin_bar ) { - if ( gutenberg_use_widgets_block_editor() ) { + if ( gutenberg_use_widgets_block_editor() && ! is_admin() ) { $wp_admin_bar->add_menu( array( 'id' => 'widgets', From 56e150472f16b477800af49457a20b68dc70b447 Mon Sep 17 00:00:00 2001 From: JustinyAhin Date: Mon, 3 May 2021 13:10:42 +0100 Subject: [PATCH 2/3] On admin, check if the widget screen menu link exists in the admin bar --- lib/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.php b/lib/init.php index c1240dfab11d5..6f90dc981121b 100644 --- a/lib/init.php +++ b/lib/init.php @@ -113,7 +113,7 @@ function gutenberg_site_editor_menu() { * @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API. */ function modify_admin_bar( $wp_admin_bar ) { - if ( gutenberg_use_widgets_block_editor() && ! is_admin() ) { + if ( gutenberg_use_widgets_block_editor() && $wp_admin_bar->get_node( 'widgets' ) !== NULL ) { $wp_admin_bar->add_menu( array( 'id' => 'widgets', From 640a9227381b208bfb052f3d373b0b3fa5ba45ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Justin=20S=C3=A8gb=C3=A9dji=20Ahinon?= Date: Wed, 5 May 2021 08:59:24 +0100 Subject: [PATCH 3/3] Update lib/init.php Co-authored-by: Koen Van den Wijngaert --- lib/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/init.php b/lib/init.php index 6f90dc981121b..e22542766f87e 100644 --- a/lib/init.php +++ b/lib/init.php @@ -113,7 +113,7 @@ function gutenberg_site_editor_menu() { * @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API. */ function modify_admin_bar( $wp_admin_bar ) { - if ( gutenberg_use_widgets_block_editor() && $wp_admin_bar->get_node( 'widgets' ) !== NULL ) { + if ( gutenberg_use_widgets_block_editor() && $wp_admin_bar->get_node( 'widgets' ) !== null ) { $wp_admin_bar->add_menu( array( 'id' => 'widgets',