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.

Merges [36261] to the 4.4 branch.
Props chandrapatel.
See #32637.
Fixes #35355.

Built from https://develop.svn.wordpress.org/branches/4.4@36363


git-svn-id: http://core.svn.wordpress.org/branches/4.4@36330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-01-20 08:37:26 +00:00
parent 7d81c464aa
commit 5daed64fde
1 changed files with 3 additions and 1 deletions

View File

@ -1535,9 +1535,11 @@ final class WP_Customize_Manager {
*/ */
public function get_return_url() { public function get_return_url() {
$referer = wp_get_referer(); $referer = wp_get_referer();
$excluded_referer_basenames = array( 'customize.php', 'wp-login.php' );
if ( $this->return_url ) { if ( $this->return_url ) {
$return_url = $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; $return_url = $referer;
} else if ( $this->preview_url ) { } else if ( $this->preview_url ) {
$return_url = $this->preview_url; $return_url = $this->preview_url;