WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp safe redirect

Description

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.

Usage

<?php wp_safe_redirect$location$status ); ?>

Parameters

$location
(string) (required)
Default: None
$status
(integer) (optional)
Default: 302

Return Values

(void) 
Does not return anything

Change Log

Since: 2.3

Source File

wp_safe_redirect() is located in wp-includes/pluggable.php

Related

See also index of Function Reference and index of Template Tags.