Make WordPress Core


Ignore:
Timestamp:
07/07/2015 05:48:23 PM (9 years ago)
Author:
obenland
Message:

Menus: Respect context when linking to the Customizer.

Manage in Customizer will now link to menu locations or the menus panel in
the customizer, depending on whether the user is editing menus or managing
locations.

Props rabmalin for initial patch.
Fixes #32852.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/nav-menus.php

    r33067 r33112  
    563563        <?php if ( $num_locations && $menu_count ) : ?>
    564564            <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
    565         <?php endif; ?>
    566565        <?php
    567             if ( current_user_can( 'customize' ) ) {
     566            endif;
     567
     568            if ( current_user_can( 'customize' ) ) :
     569                $focus = $locations_screen ? array( 'section' => 'menu_locations' ) : array( 'panel' => 'nav_menus' );
    568570                printf(
    569571                    ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
    570                     esc_url( add_query_arg(
    571                         array(
    572                             array( 'autofocus' => array( 'panel' => 'nav_menus' ) ),
    573                             'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) )
    574                         ),
    575                         admin_url( 'customize.php' )
    576                     ) ),
     572                    esc_url( add_query_arg( array(
     573                        array( 'autofocus' => $focus ),
     574                        'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
     575                    ), admin_url( 'customize.php' ) ) ),
    577576                    __( 'Manage in Customizer' )
    578577                );
    579             }
     578            endif;
    580579        ?>
    581580    </h1>
Note: See TracChangeset for help on using the changeset viewer.