如果我想获得当前用户的自定义字段,我将使用类似的东西。

<?php echo get_user_meta($user_info->ID,'address_line_2',true);?>

但是,这次我想要作者,所以我尝试了以下多个版本,但无济于事。

<?php 
$thisauthorID = get_the_author_ID();

echo get_the_author_meta($thisauthorID,'address',true)
        ;?>

有任何想法吗?

奇妙

有帮助吗?

解决方案

get_the_author_meta() != get_user_meta().
改成:
echo get_the_author_meta('address', $thisauthorID);

许可以下: CC-BY-SA归因
scroll top