首页 > 解决方案 > 如何获取当前用户的 buddypress 字段?

问题描述

如何在 buddyPress 中获取当前连接用户的字段值?

例如:如何打印:

My gender is : {gender}

标签: buddypress

解决方案


获取当前用户id:get_current_user_id() 然后使用xprofile_get_field_data

我的性别是:<?php echo xprofile_get_field_data('gender', get_current_user_id(), 'comma'); ?>

http://hookr.io/functions/xprofile_get_field_data/


推荐阅读