allowed_redirect_hosts
Filters the list of allowed hosts to redirect to.
Usage
add_filter( 'allowed_redirect_hosts', 'wp_kama_allowed_redirect_hosts_filter', 10, 2 ); /** * Function for `allowed_redirect_hosts` filter-hook. * * @param string[] $hosts An array of allowed host names. * @param string $host The host name of the redirect destination; empty string if not set. * * @return string[] */ function wp_kama_allowed_redirect_hosts_filter( $hosts, $host ){ // filter... return $hosts; }
- $hosts(string[])
- An array of allowed host names.
- $host(string)
- The host name of the redirect destination; empty string if not set.
Changelog
Since 2.3.0 | Introduced. |
Where the hook is called
allowed_redirect_hosts
wp-includes/pluggable.php 1625
$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' );
Where the hook is used in WordPress
wp-includes/ms-default-filters.php 75
add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );