wordpress wp_redirect
wordpress重定向
wp_redirect( string $location, int $status = 302 )
使用
wp_redirect( $url );
exit;
例子
-
默认302重定向
<?php wp_redirect( home_url() ); exit; ?>
-
指定301重定向
<?php wp_redirect( 'http://www.example.com', 301 ); exit; ?>
直接这样也行,php自带的
header('location:地址');
php常用的header头
https://www.blyoo.com/1371.html
WordPress官方文档:https://developer.wordpress.org/reference/functions/wp_redirect/