采用WordPress的WP_User_Query与WP_User结合实现排除了指定role的用户列表展示,经过不断的研究摸索,找到一个较为完美的实现方案,分享给大家:

<?php 
		$avatar_size = 100;
		$authors = array();
    	        $exclude = array('1');
        $authors_query = new WP_User_Query( array(
            'exclude' => $exclude,
            'orderby' => 'url',
	    'order' => 'ASC'
            ) );
        $results = $authors_query->get_results();
        if ($results) $authors = array_merge($authors, $results);

foreach($authors as $author) {

$user = new WP_User( $author->ID );
	//if ( !empty( $author->roles ) && is_array( $author->roles ) ) {

		foreach ( $user->roles as $role )
			if (($role)&&($role!="subscriber")) { 
				//$display_name = $author['display_name'];
				//$display_name = the_author($author['ID']);
				$avatar = get_avatar($author->ID, $avatar_size);
				//$author_desc = the_author_description($author['ID']);
				//$author_descri = the_author_meta( 'description' ,$author['ID']);
				$author_profile_url = get_author_posts_url($author->ID);
				echo '<div class="one-artist">';
				echo '<a href="'.$author_profile_url.'">';
				echo $avatar;
				echo '<br />'; 
				echo the_author_meta( 'display_name', $author->ID);
				echo '<br />'; 
				echo the_author_meta( 'description', $author->ID);
				echo '</a>';
				echo '</div>';
//}
}
			}
		 ?>

以上代码实现了排除admin用户和角色为subscriber的用户以外的所有用户,而且这个角色排除可以根据需要进行额外的扩展,排除多个角色。