Make WordPress Core


Ignore:
Timestamp:
11/01/2015 06:39:50 AM (8 years ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

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

    r34651 r35483  
    526526        }
    527527
     528        $customize_action = null;
     529        if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
     530            $customize_action = esc_url( add_query_arg(
     531                array(
     532                    'return' => urlencode( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
     533                ),
     534                wp_customize_url( $slug )
     535            ) );
     536        }
     537
    528538        $prepared_themes[ $slug ] = array(
    529539            'id'           => $slug,
     
    541551            'actions'      => array(
    542552                'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
    543                 'customize' => ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) ? wp_customize_url( $slug ) : null,
     553                'customize' => $customize_action,
    544554                'delete'   => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null,
    545555            ),
Note: See TracChangeset for help on using the changeset viewer.