如何显示用户配置文件中的 acf 字段?

How to display an acf field from a user profile?

我目前在用户配置文件中有一个高级自定义字段设置,字段名称为 author_title。这将显示用户在公司博客上所做的事情。

我目前有以下工作,但标题仅为第一个用户更新,所有用户都获得该标题,而不是能够使用他们自己的标题。

已更新

<?php $current_user = wp_get_current_user(); ?>  
<h3><?php the_field('author_title', 'user_' . $current_user->ID); ?></h3>

尝试通过其他方式获取用户ID。

现在您可以获得当前登录用户的 ID,因此它在所有地方都显示相同的字段。我假设您需要显示提交作者帖子的情况:

$author_id = get_the_author_meta('ID');
$author_field = get_field('author_title', 'user_'. $author_id );