Customize: Prevent links to `customize.php` from being generated which have query vars from `wp_removable_query_args()` present.

Props dlh.
See #23367, #32692.
Fixes #31850.

Merges [40313] to the 4.7 branch.



git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40331 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2017-03-25 13:34:27 +00:00
parent 0145add43a
commit b10061bf8e
4 changed files with 4 additions and 4 deletions

View File

@ -578,7 +578,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$customize_action = esc_url( add_query_arg( $customize_action = esc_url( add_query_arg(
array( array(
'return' => urlencode( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'return' => urlencode( esc_url_raw( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ),
), ),
wp_customize_url( $slug ) wp_customize_url( $slug )
) ); ) );

View File

@ -156,7 +156,7 @@ $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' ); $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'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
$customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' ); $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' ); $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {

View File

@ -584,7 +584,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>', ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
esc_url( add_query_arg( array( esc_url( add_query_arg( array(
array( 'autofocus' => $focus ), array( 'autofocus' => $focus ),
'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'return' => urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
), admin_url( 'customize.php' ) ) ), ), admin_url( 'customize.php' ) ) ),
__( 'Manage with Live Preview' ) __( 'Manage with Live Preview' )
); );

View File

@ -355,7 +355,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
esc_url( add_query_arg( esc_url( add_query_arg(
array( array(
array( 'autofocus' => array( 'panel' => 'widgets' ) ), array( 'autofocus' => array( 'panel' => 'widgets' ) ),
'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) 'return' => urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) )
), ),
admin_url( 'customize.php' ) admin_url( 'customize.php' )
) ), ) ),