wp_safe_redirect()获取一个安全的重定向链接

目录

描述

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.

wp_safe_redirect() 描述

用法

wp_safe_redirect() does not exit automatically and should almost always be followed by exit.

wp_safe_redirect() 用法

参数

$location

(string) (必填)

默认值: None

$status

(integer) (可选)

默认值: 302

wp_safe_redirect() 参数

返回值

(void

Does not return anything

wp_safe_redirect() 返回值

历史

添加于 版本: 2.3

wp_safe_redirect() 历史

源文件

wp_safe_redirect() 函数的代码位于 wp-includes/pluggable.php

wp_safe_redirect() 源文件

相关