I have a fairly basic user query pulling staff members on a website I'm working on. When you are logged in to WordPress they are showing on the front-end. But when logged out they are not displaying. I did a var_dump and it is returning empty when logged out. I cannot find any logical reason for this. I tried without querying a role and it does the same thing.
<?php
$args = array(
'role__in' => array('Staff')
);
// The Query
$user_query = get_users( $args );
var_dump($user_query);
// User Loop
foreach ( $user_query as $user ) { ?>
<?php $job_title = get_field('job_title', 'user_'. $user->ID ); ?>
<div class="each-staff">
<a class="staff-image" href="<?php echo get_author_posts_url( $user->id ); ?>"><img src="<?php echo esc_url( get_avatar_url( $user->ID ) ); ?>" /></a>
<div class="staff-info">
<h4 class="staff-name"><a href="<?php echo get_author_posts_url( $user->id ); ?>"><?php echo $user->display_name; ?></a></h4>
<h5><?php echo $job_title; ?></h5>
</div>
</div>
<?php }
?>