apply_filters( ‘allowed_redirect_hosts’, string[] $hosts, string $host )

Filters the list of allowed hosts to redirect to.

Parameters

$hostsstring[]
An array of allowed host names.
$hoststring
The host name of the redirect destination; empty string if not set.

Source

$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array( $wpp['host'] ), isset( $lp['host'] ) ? $lp['host'] : '' );

Changelog

VersionDescription
2.3.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Allow additional redirect hosts

    You can allow additional hosts when validating redirects by using the allowed_redirect_hosts filter.

    function my_allowed_redirect_hosts( $hosts ) {
    	$my_hosts = array(
    		'blog.example.com',
    		'codex.example.com',
    	);
    	return array_merge( $hosts, $my_hosts );
    };
    add_filter( 'allowed_redirect_hosts', 'my_allowed_redirect_hosts' );

You must log in before being able to contribute a note or feedback.