is_user_logged_in()
is_user_logged_in() 确定当前访问者是否为登录用户。Determines whether t…
is_user_logged_in()
确定当前访问者是否为登录用户。
Determines whether the current visitor is a logged in user.
目录锚点:#说明#返回#源码#笔记
说明(Description)
有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。
返回(Return)
(bool)如果用户已登录,则为True;如果未登录,则为false。
源码(Source)
/**
* Checks if the current visitor is a logged in user.
*
* @since 2.0.0
*
* @return bool True if user is logged in, false if not logged in.
*/
function is_user_logged_in() {
$user = wp_get_current_user();
return $user->exists();
}
endif;
if ( !function_exists('auth_redirect') ) :| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.0.0 | wp-includes/pluggable.php:1012 | 44 | 1 function |
笔记(Notes)
示例:根据用户是否登录,显示不同的输出。
请注意,is_user_logged_是一个可插入的函数,如果过早调用它,可能会出现致命错误。
示例:从您的函数文件中,此代码显示登录用户的个人消息。
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!