Home › Forums › General Issues › User Field Type Issues › Reply To: User Field Type Issues
Thanks so much for the help! I am getting close but one last question. With this snippet I am able to print the assigned users and display the fields. The only issue is for displaying it only shows one of the user biographies despite the print_r showing the two.
<?php
$users = get_field('guests2');
echo '<pre>'; print_r($users); echo '</pre>'; // Prints out assigned user data
if ($users): ?>
<?php foreach ($users as $user): ?>
<?php setup_postdata($user);
$userID = $user['ID'];
$profile_image = get_field('profile_image', 'user_'. $userID);
$biography = get_field('biography', 'user_'. $userID);
?>
<?php echo $biography; ?> // Only displays first user data rather than all
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.