Make WordPress Core


Ignore:
Timestamp:
11/15/2021 03:42:08 AM (3 years ago)
Author:
noisysocks
Message:

Editor: Fix how the Site Editor is linked to

  • Add 'Edit site' to the top admin bar.
  • Link to the Template and Template Part CPTs.
  • Add deep link to the Global Styles UI.

Follows [52069].
See #54337.

File:
1 edited

Legend:

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

    r52134 r52158  
    410410
    411411/**
     412 * Adds the "Edit site" link to the Toolbar.
     413 *
     414 * @since 5.9.0
     415 *
     416 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
     417 */
     418function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
     419    // Don't show if a block theme is not activated.
     420    if ( ! wp_is_block_template_theme() ) {
     421        return;
     422    }
     423
     424    // Don't show for users who can't edit theme options or when in the admin.
     425    if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
     426        return;
     427    }
     428
     429    $wp_admin_bar->add_node(
     430        array(
     431            'id'    => 'site-editor',
     432            'title' => __( 'Edit site' ),
     433            'href'  => admin_url( 'site-editor.php' ),
     434        )
     435    );
     436}
     437
     438/**
    412439 * Adds the "Customize" link to the Toolbar.
    413440 *
     
    419446function wp_admin_bar_customize_menu( $wp_admin_bar ) {
    420447    global $wp_customize;
     448
     449    // Don't show if a block theme is activated.
     450    if ( wp_is_block_template_theme() ) {
     451        return;
     452    }
    421453
    422454    // Don't show for users who can't access the customizer or when in the admin.
     
    429461        && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() )
    430462    ) {
    431         return;
    432     }
    433 
    434     // Don't show if a block theme is activated.
    435     if ( wp_is_block_template_theme() ) {
    436463        return;
    437464    }
Note: See TracChangeset for help on using the changeset viewer.