小编use*_*148的帖子

如何在wordpress中获得用户的名字?

这是我在wordpress functions.php中的代码。我想在重力形式字段中显示用户信息顶部功能起作用,但底部功能不起作用,我不知道该使用什么来显示名字。

add_filter('gform_field_value_pm_id', 'populate_pm_id');
function populate_pm_id($value){
    return $user_ID = get_current_user_id(); 
    echo $user_ID = get_current_user_id(); 

}

add_filter('gform_field_value_pm_firstname', 'populate_pm_firstname');
function populate_pm_firstname($value){
    return $user_info->first_name = get current_user_first_name(); 
    echo $user_info->first_name = get_current_user_first_name();

}
Run Code Online (Sandbox Code Playgroud)

php wordpress utf-8 wordpress-plugin gravity-forms-plugin

3
推荐指数
1
解决办法
3693
查看次数