First, let me say that it is not “Strangely” working using ‘subscribers’ role. Note that you are taking out the ‘subscriber’ role from the results.
The correct way to get only authors and exclude some IDs is using the role
and exclude
arguments of get_users()
function:
<?php
$args = array(
'role' => 'author',
//authors with ID 2 and 3 will be excluded
'exclude' => array( 2, 3 ),
'orderby' => 'post_count',
'order' => 'DESC'
);
$authors = get_users( $args );
?>
<section class="content" role="main">
<?php
printf( '<h1>%s</h1>', the_title() );
foreach($authors as $author) {
?>
<div class="col-xs-6 col-md-3">
<div class="col-lg-12">
<div class="thumbnail">
<?php echo get_avatar( $author->user_email, '200' ); ?>
</div>
<div class="caption">
<h4><?php echo $author->display_name; ?><small><?php echo stripslashes(esc_attr( get_the_author_meta('job_titel', $curauth->ID ) ) ); ?></small></h4>
<p> locatie </p>
<p><a href="https://wordpress.stackexchange.com/questions/154767/<?php echo get_author_posts_url( $author->ID ); ?>"> Bekijk profiel</a></p>
</div>
</div>
</div>
<?php } ?>