Customizer: Prevent erroneously directing user to login screen when closing.

Fixes issue where user gets stuck at login screen after trying to close the app if previously they had to first login to access the Customizer. Prevents `WP_Customize_Manager::get_return_url()` from using `wp-login.php` as a referer.

Props chandrapatel.
See #32637.
Fixes #35355.

Built from https://develop.svn.wordpress.org/trunk@36261


git-svn-id: http://core.svn.wordpress.org/trunk@36228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-01-11 18:51:28 +00:00
parent 9b486acb9b
commit 3e35a7157f
2 changed files with 4 additions and 2 deletions

View File

@ -1579,9 +1579,11 @@ final class WP_Customize_Manager {
*/
public function get_return_url() {
$referer = wp_get_referer();
$excluded_referer_basenames = array( 'customize.php', 'wp-login.php' );
if ( $this->return_url ) {
$return_url = $this->return_url;
} else if ( $referer && 'customize.php' !== basename( parse_url( $referer, PHP_URL_PATH ) ) ) {
} else if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
$return_url = $referer;
} else if ( $this->preview_url ) {
$return_url = $this->preview_url;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36260';
$wp_version = '4.5-alpha-36261';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.