mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
Customize: Return user to referring URL when leaving Customizer in absence of return query param.
When referring URL is not available, default returning user to frontend URL instead of admin URL. Themes page is updated to include the `return` path in Customizer links. Props McGuive7, westonruter. Fixes #32637. git-svn-id: https://develop.svn.wordpress.org/trunk@35483 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -525,6 +525,16 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
$parents[ $slug ] = $theme->parent()->get_stylesheet();
|
||||
}
|
||||
|
||||
$customize_action = null;
|
||||
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
|
||||
$customize_action = esc_url( add_query_arg(
|
||||
array(
|
||||
'return' => urlencode( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
|
||||
),
|
||||
wp_customize_url( $slug )
|
||||
) );
|
||||
}
|
||||
|
||||
$prepared_themes[ $slug ] = array(
|
||||
'id' => $slug,
|
||||
'name' => $theme->display( 'Name' ),
|
||||
@@ -540,7 +550,7 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
'update' => get_theme_update_available( $theme ),
|
||||
'actions' => array(
|
||||
'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
|
||||
'customize' => ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) ? wp_customize_url( $slug ) : null,
|
||||
'customize' => $customize_action,
|
||||
'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user