Languages: English • 日本語 Italiano • (Add your language)
Performs a safe (local) redirect, using wp_redirect().
Checks whether the $location is using an allowed host, if it has an absolute path. A plugin can therefore set or remove allowed host(s) to or from the list.
If the host is not allowed, then the redirect is to wp-admin on the siteurl instead. This prevents malicious redirects which redirect to another host, but only used in a few places.
The list of safe hosts can be hooked into via the allowed_redirect_hosts filter.
wp_safe_redirect() does not exit automatically and should almost always be followed by exit.
<?php wp_safe_redirect( $location, $status ); exit; ?>
Since: 2.3
wp_safe_redirect() is located in wp-includes/pluggable.php