WordPress.org

Make WordPress Core

Ticket #34028: 34028.2.diff

File 34028.2.diff, 1.2 KB (added by layotte, 5 years ago)

Patch to only modify the lines related to this ticket

  • wp-includes/pluggable.php

     
    13471347        if ( isset($lp['scheme'])  && !isset($lp['host']) )
    13481348                return $default;
    13491349
    1350         $wpp = parse_url(home_url());
     1350        $home = parse_url(home_url());
     1351        $site = parse_url(site_url());
    13511352
    13521353        /**
    13531354         * Filter the whitelist of hosts to redirect to.
     
    13571358         * @param array       $hosts An array of allowed hosts.
    13581359         * @param bool|string $host  The parsed host; empty if not isset.
    13591360         */
    1360         $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
     1361        $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($home['host'], $site['host']), isset($lp['host']) ? $lp['host'] : '' );
    13611362
    1362         if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
     1363        if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && ( $lp['host'] != strtolower($home['host']) || $lp['host'] != strtolower($site['host']) ) ) )
    13631364                $location = $default;
    13641365
    13651366        return $location;