Home › Forums › Front-end Issues › the_field and get_field is not working in get_users loop › Reply To: the_field and get_field is not working in get_users loop
Hey, @vverner, thanks for the reply! I added your code (not sure if it’s in the right place though ) but nothing happened. The code below still just outputs the display_name but not the org_name field.
Is it in the wrong place? What else am I doing wrong?
<?php
$args = array(
'role' => 'organization',
'orderby' => 'login',
'order' => 'ASC',
);
$org_users = get_users( $args );
foreach ($org_users as $user) {
$user_id = get_current_user_id();
get_field("org_name","user_".$user_id);
echo '<div class="resource-item">';
echo '<p>';
echo esc_html( $user->display_name );
echo the_field("org_name","user_".$user_id);
echo '<br>';
echo '</p>';
echo '</div>';
}
?>
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.