When accessing the Customizer from the admin menu, make sure the user is returned to the originating page upon close. We should still investigate the general usage of `customize-loader.js` moving forward, but this approach fixes the immediate issue. props westonruter. fixes #25457.
Built from https://develop.svn.wordpress.org/trunk@29026 git-svn-id: http://core.svn.wordpress.org/trunk@28814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b6d3c0841e
commit
725c824075
|
@ -12,16 +12,20 @@ define( 'IFRAME_REQUEST', true );
|
|||
/** Load WordPress Administration Bootstrap */
|
||||
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||
|
||||
if ( ! current_user_can( 'edit_theme_options' ) )
|
||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||
wp_die( __( 'Cheatin’ uh?' ) );
|
||||
}
|
||||
|
||||
wp_reset_vars( array( 'url', 'return' ) );
|
||||
$url = urldecode( $url );
|
||||
$url = wp_unslash( $url );
|
||||
$url = wp_validate_redirect( $url, home_url( '/' ) );
|
||||
if ( $return )
|
||||
$return = wp_validate_redirect( urldecode( $return ) );
|
||||
if ( ! $return )
|
||||
if ( $return ) {
|
||||
$return = wp_unslash( $return );
|
||||
$return = wp_validate_redirect( $return );
|
||||
}
|
||||
if ( ! $return ) {
|
||||
$return = $url;
|
||||
}
|
||||
|
||||
global $wp_scripts, $wp_customize;
|
||||
|
||||
|
|
|
@ -146,9 +146,13 @@ $appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_t
|
|||
|
||||
$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
|
||||
$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
|
||||
$submenu['themes.php'][6] = array( __( 'Customize' ), 'edit_theme_options', 'customize.php', 'hide-if-no-customize' );
|
||||
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
|
||||
|
||||
$customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
|
||||
$submenu['themes.php'][6] = array( __( 'Customize' ), 'edit_theme_options', $customize_url, 'hide-if-no-customize' );
|
||||
unset( $customize_url );
|
||||
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
|
||||
$submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php');
|
||||
}
|
||||
|
||||
unset( $appearance_cap );
|
||||
|
||||
|
|
Loading…
Reference in New Issue