get_current_user_id()
get_current_user_id()
获取当前用户的ID
Get the current user’s ID
返回(Return)
(int)当前用户的ID,如果没有用户登录,则为0。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
MU (3.0.0) | wp-includes/user.php:440 | 98 | 1 function |
笔记(Notes)
丹尼尔·艾哈迈德的例子是多余的。
在插件加载操作之前,它返回0。
此函数不是检索当前登录用户的方法,因为到目前为止,它已经非常清楚地说明了一些示例。
get_current_user_id() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_current_user_id/