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
742      $location = wp_sanitize_redirect($location);
743
744      // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
745      if ( substr($location, 0, 2) == '//' )
746           $location = 'http:' . $location;
747
748      $lp  = parse_url($location);
749      $wpp = parse_url(get_option('home'));
750
751      $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
752
753      if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
754           $location = get_option('siteurl') . '/wp-admin/';
755
756      wp_redirect($location, $status);
757 }
758 endif;
759
760 if ( ! function_exists('wp_notify_postauthor') ) :