From f578d8ebabff0df2374b61ad31a3225289fc3d53 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Mon, 3 Mar 2025 20:05:52 +0000 Subject: [PATCH] Admin bar: Update the "Edit Site" link. This changeset replaces the "Edit Site" link in the admin bar to point to the top level screen of the Site Editor, instead of opening the current template. Merges Gutenberg changeset: WordPress/gutenberg#69271 Props mosne, poena, audrasjb, shailu25. Fixes #62368. git-svn-id: https://develop.svn.wordpress.org/trunk@59910 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/admin-bar.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 5fe00e9801..3765c1fb45 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -458,21 +458,19 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) { * @since 5.9.0 * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar. * @since 6.6.0 Added the `canvas` query arg to the Site Editor link. - * - * @global string $_wp_current_template_id + * @since 6.8.0 Removed the query args to ensure that the link opens the starting screen of the Site Editor. * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */ function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { - global $_wp_current_template_id; // Don't show if a block theme is not activated. if ( ! wp_is_block_theme() ) { return; } - // Don't show for users who can't edit theme options or when in the admin. - if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) { + // Don't show for users who can't edit theme options. + if ( ! current_user_can( 'edit_theme_options' ) ) { return; } @@ -480,14 +478,7 @@ function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { array( 'id' => 'site-editor', 'title' => __( 'Edit Site' ), - 'href' => add_query_arg( - array( - 'postType' => 'wp_template', - 'postId' => $_wp_current_template_id, - 'canvas' => 'edit', - ), - admin_url( 'site-editor.php' ) - ), + 'href' => admin_url( 'site-editor.php' ), ) ); }