Retrieve ACF fields attached to user profiles using the user ID prefix syntax.
ACF uses a user_{id} format for the $post_id parameter when working with user fields:
<?php
$user_id = 5;
$bio = get_field( 'biography', 'user_' . $user_id );
$photo = get_field( 'profile_photo', 'user_' . $user_id );
$title = get_field( 'job_title', 'user_' . $user_id );
Get fields for the currently logged-in user:
<?php
$current_user_id = get_current_user_id();
if ( $current_user_id ) {
$bio = get_field( 'biography', 'user_' . $current_user_id );
$photo = get_field( 'profile_photo', 'user_' . $current_user_id );
if ( $photo ) {
echo wp_get_attachment_image( $photo, 'thumbnail', false, [
'class' => 'user-avatar',
] );
}
if ( $bio ) {
echo '<p>' . esc_html( $bio ) . '</p>';
}
}
Display fields for the current post’s author:
<?php
$author_id = get_the_author_meta( 'ID' );
$twitter = get_field( 'twitter_handle', 'user_' . $author_id );
$bio = get_field( 'biography', 'user_' . $author_id );
?>
<div class="author-box">
<?php echo get_avatar( $author_id, 80 ); ?>
<h4><?php the_author(); ?></h4>
<?php if ( $bio ) : ?>
<p><?php echo esc_html( $bio ); ?></p>
<?php endif; ?>
<?php if ( $twitter ) : ?>
<a href="https://twitter.com/<?php echo esc_attr( $twitter ); ?>">@<?php echo esc_html( $twitter ); ?></a>
<?php endif; ?>
</div>
Note: You can also pass a WP_User object directly to get_field() — ACF resolves it automatically.