WordPress.org

Make WordPress Core

Changeset 35635


Ignore:
Timestamp:
11/13/2015 05:24:28 AM (4 years ago)
Author:
westonruter
Message:

Customize: Exclude referer URL from being used for Close link if it is customize.php.

This fixes an edge case where the Close button could never link the user out of the Customizer, if the user initially accessed it without a url param and then clicked a link (provided by a plugin) that took them to another customize.php URL.

See #32637.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r35553 r35635  
    14771477        if ( $this->return_url ) {
    14781478            $return_url = $this->return_url;
    1479         } else if ( $referer ) {
     1479        } else if ( $referer && 'customize.php' !== basename( parse_url( $referer, PHP_URL_PATH ) ) ) {
    14801480            $return_url = $referer;
    14811481        } else if ( $this->preview_url ) {
  • trunk/tests/phpunit/tests/customize/manager.php

    r35553 r35635  
    261261        $preview_url = home_url( '/foo/' );
    262262        $this->manager->set_preview_url( $preview_url );
     263        $this->assertEquals( $preview_url, $this->manager->get_return_url() );
     264
     265        $_SERVER['HTTP_REFERER'] = wp_slash( admin_url( 'customize.php' ) );
    263266        $this->assertEquals( $preview_url, $this->manager->get_return_url() );
    264267
Note: See TracChangeset for help on using the changeset viewer.