wordpress如何获取当前登录用户的基本信息

591 ℃

有很多wordpress站是需要用户注册登录,并且需要把用户的基本信息显示出来,那么如何获取当前登录用户的基本信息呢?下面web建站小编给大家简单介绍一下具体代码!

这里我们需要使用get_currentuserinfo()函数!

具体代码如下:

<?php global $current_user, $display_name , $user_email;
  get_currentuserinfo();
  
  //全局变量$current_user
  echo '用户登录账号: ' . $current_user->user_login . "n";
  echo '用户邮箱: ' . $current_user->user_email . "n";
  echo '用户的名: ' . $current_user->user_firstname . "n";
  echo '用户的姓: ' . $current_user->user_lastname . "n";
  echo '用户显示名称: ' . $current_user->display_name . "n";
  echo '用户ID: ' . $current_user->ID . "n";
  
  //单独的全局变量
  echo $display_name . "'邮箱地址: " . $user_email;
?>

WordPress如何判断当前文章是否是密码保护文章

WordPress版本如何使用str_starts_with和str_ends_with函数

WordPress如何显示当前文章的评论个数

wordpress如何显示下个评论链接

wordpress教程如何输出用于回复评论的隐藏输入html

标签: get_currentuserinfo, wordpress函数, wordpress获取用户信息

上面是“wordpress如何获取当前登录用户的基本信息”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。

当前网址:https://m.ipkd.cn/webs_3758.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

vue项目中如何在el-input运用正则表达式
vue项目中axios如何解决跨域cookie丢失问题
wordpress如何把文章的第一段显示为摘要?(不出现html标签)
搜狗搜索改版了吗?搜狗排名为什么突然多出了
Coze扣子