登录账号之后才能查看页面
函数: 1 <?php auth_redirect(); ?> 例子 1 2 3 4 5 <…
函数:
|
1
|
<?php auth_redirect(); ?>
|
例子
|
1
2
3
4
5
|
<?php
if(!is_user_logged_in()){
auth_redirect();
}
?>
|
使用:
|
1
2
3
4
5
6
7
8
|
add_action( ‘template_redirect’, ‘ashuwp_show_only_login’, 0 );
function ashuwp_show_only_login(){
//判断登录
if( !is_user_logged_in() ){
auth_redirect(); //跳转到登录页面
exit;
}
}
|
源文件地址:
|
1
|
auth_redirect()位于 wp–includes/pluggable.php
|
类别:WordPress开发、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论功能已经关闭!