Make WordPress Core

Changeset 59910


Ignore:
Timestamp:
03/03/2025 08:05:52 PM (4 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r59850 r59910  
    459459 * @since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
    460460 * @since 6.6.0 Added the `canvas` query arg to the Site Editor link.
    461  *
    462  * @global string $_wp_current_template_id
     461 * @since 6.8.0 Removed the query args to ensure that the link opens the starting screen of the Site Editor.
    463462 *
    464463 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
    465464 */
    466465function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
    467     global $_wp_current_template_id;
    468466
    469467    // Don't show if a block theme is not activated.
     
    472470    }
    473471
    474     // Don't show for users who can't edit theme options or when in the admin.
    475     if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
     472    // Don't show for users who can't edit theme options.
     473    if ( ! current_user_can( 'edit_theme_options' ) ) {
    476474        return;
    477475    }
     
    481479            'id'    => 'site-editor',
    482480            'title' => __( 'Edit Site' ),
    483             'href'  => add_query_arg(
    484                 array(
    485                     'postType' => 'wp_template',
    486                     'postId'   => $_wp_current_template_id,
    487                     'canvas'   => 'edit',
    488                 ),
    489                 admin_url( 'site-editor.php' )
    490             ),
     481            'href'  => admin_url( 'site-editor.php' ),
    491482        )
    492483    );
Note: See TracChangeset for help on using the changeset viewer.