Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: allowed_redirect_hosts

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
950      if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
951           return $default;
952
953      // Reject if scheme is set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
954      if ( isset($lp['scheme'])  && !isset($lp['host']) )
955           return $default;
956
957      $wpp = parse_url(home_url());
958
959      $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
960
961      if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
962           $location = $default;
963
964      return $location;
965 }
966 endif;
967
968 if ( ! function_exists('wp_notify_postauthor') ) :