From 57408e271acfdd2ae7b7c8990c13c57a7c01fcb2 Mon Sep 17 00:00:00 2001 From: "Aaron D. Campbell" Date: Sun, 6 Dec 2015 21:16:12 +0000 Subject: [PATCH] Consider both home and site domains to be valid in `wp_validate_redirect()`. Props layotte. Fixes #34028. git-svn-id: https://develop.svn.wordpress.org/trunk@35792 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pluggable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 88d1440599..922c3aed3e 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -1348,6 +1348,7 @@ function wp_validate_redirect($location, $default = '') { return $default; $wpp = parse_url(home_url()); + $site = parse_url( site_url() ); /** * Filter the whitelist of hosts to redirect to. @@ -1357,9 +1358,9 @@ function wp_validate_redirect($location, $default = '') { * @param array $hosts An array of allowed hosts. * @param bool|string $host The parsed host; empty if not isset. */ - $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' ); + $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'], $site['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' ); - if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) + if ( isset($lp['host']) && ( ! in_array( $lp['host'], $allowed_hosts ) && ( $lp['host'] != strtolower( $wpp['host'] ) || $lp['host'] != strtolower( $site['host'] ) ) ) ) $location = $default; return $location; @@ -2480,4 +2481,3 @@ function wp_text_diff( $left_string, $right_string, $args = null ) { return $r; } endif; -