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
428      $location = wp_sanitize_redirect($location);
429
430      // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
431      if ( substr($location, 0, 2) == '//' )
432           $location = 'http:' . $location;
433
434      $lp  = parse_url($location);
435      $wpp = parse_url(get_option('home'));
436
437      $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), $lp['host']);
438
439      if ( isset($lp['host']) && !in_array($lp['host'], $allowed_hosts) )
440           $location = get_option('siteurl') . '/wp-admin/';
441
442      wp_redirect($location, $status);
443 }
444 endif;
445
446 if ( !function_exists('wp_get_cookie_login') ):