Admin bar: Update the "Edit Site" link to 6.7 destination.

This reverts [59910] and changes the "Edit Site" link to be the current template rather than the top-level screen of the Site Editor.

Reviewed by SergeyBiryukov, desrosj.
Merges [60193] to the 6.8 branch.

Props wildworks, joemcgill, poena, westonruter, nickwilmot, marktimemedia, eduwass, lilgames, codeamp, jeffr0, jorbin.
Fixes #63358. See #62368.
Built from https://develop.svn.wordpress.org/branches/6.8@60194


git-svn-id: http://core.svn.wordpress.org/branches/6.8@59530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj
2025-04-28 15:12:27 +00:00
parent 8913eb2446
commit d6d70906d1
2 changed files with 14 additions and 5 deletions

View File

@@ -458,19 +458,21 @@ 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.
* @since 6.8.0 Removed the query args to ensure that the link opens the starting screen of the Site Editor.
*
* @global string $_wp_current_template_id
*
* @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.
if ( ! current_user_can( 'edit_theme_options' ) ) {
// 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() ) {
return;
}
@@ -478,7 +480,14 @@ function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
array(
'id' => 'site-editor',
'title' => __( 'Edit Site' ),
'href' => admin_url( 'site-editor.php' ),
'href' => add_query_arg(
array(
'postType' => 'wp_template',
'postId' => $_wp_current_template_id,
'canvas' => 'edit',
),
admin_url( 'site-editor.php' )
),
)
);
}

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.8.1-alpha-60190';
$wp_version = '6.8.1-alpha-60194';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.