常用函数-wp_redirect()

0条评论

说明

将用户重定向到一个预先制定的绝对URI。

参数

$location

(字符串)(必需)用户被重定向到的绝对URI。

默认值:None

$status

(整数)(可选)所用的状态码

默认值302

用法

<?php wp_redirect($location, $status); ?> 

示例

<?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?>  

重定向地址也可以是外部的,可使用“永久性删除”码:

<?php wp_redirect('http://www.example.com', 301); ?>

 

 

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.