Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 检查前端用户是否正在登录_Wordpress_Plugins_Login - Fatal编程技术网

Wordpress 检查前端用户是否正在登录

Wordpress 检查前端用户是否正在登录,wordpress,plugins,login,Wordpress,Plugins,Login,我正在使用“前端用户”插件进行用户注册和登录系统。现在,我如何通过我使用的“is_user_logged_in()”代码检查我的前端用户是否登录,但它检查管理面板用户。试试看 if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { echo 'Welcome, visitor!'; } 或者试试这个 global $current_user; get_currentuserinfo(); i

我正在使用“前端用户”插件进行用户注册和登录系统。现在,我如何通过我使用的“is_user_logged_in()”代码检查我的前端用户是否登录,但它检查管理面板用户。

试试看

if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
} else {
    echo 'Welcome, visitor!';
}
或者试试这个

global $current_user;
get_currentuserinfo();
if ($current_user->ID == '') { 
    //show nothing to user
}
else { 
    //write code to show menu here
}

你用的是fron end吗?您是否检查了这两种情况(登录、注销)我的用户正在登录,在此“”之后,注销链接仍然没有出现。$current\u user->ID如果用户登录或注销,则给我0。如果$current\u user->ID为空或零,则用户日志显示其他更明智的日志。