Make WordPress Core

Changeset 60193


Ignore:
Timestamp:
04/28/2025 06:35:05 AM (16 months ago)
Author:
jorbin
Message:

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.

Props wildworks, joemcgill, poena, westonruter, nickwilmot, marktimemedia, eduwass, lilgames, codeamp, jeffr0, jorbin.
Fixes #63358. See #62368.

File:
1 edited

Legend:

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

    r59910 r60193  
    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  * @since 6.8.0 Removed the query args to ensure that the link opens the starting screen of the Site Editor.
     461 *
     462 * @global string $_wp_current_template_id
    462463 *
    463464 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
    464465 */
    465466function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
     467        global $_wp_current_template_id;
    466468
    467469        // Don't show if a block theme is not activated.
     
    470472        }
    471473
    472         // Don't show for users who can't edit theme options.
    473         if ( ! current_user_can( 'edit_theme_options' ) ) {
     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() ) {
    474476                return;
    475477        }
     
    479481                        'id'    => 'site-editor',
    480482                        'title' => __( 'Edit Site' ),
    481                         'href'  => admin_url( 'site-editor.php' ),
     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                        ),
    482491                )
    483492        );
Note: See TracChangeset for help on using the changeset viewer.