Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to have the authors listed like usual from wp_list_authors() but I know there are a couple of ones I would like to exclude from the list as well. Is there a way to do that?

Thanks

share|improve this question
    
@Paul Sheldrake: Do you always want to exclude those users, or only in certain contexts? If only in certain contexts, which ones? –  MikeSchinkel Oct 7 '10 at 17:58
    
Typically I would always want to exclude them. –  Paul Sheldrake Oct 11 '10 at 20:59
add comment

3 Answers

up vote 3 down vote accepted

It seems wp_list_authors does not have any filters, nor does get_users_of_blog, the function it uses to get the user list. So you either have to regex-and-replace the output yourself, or create a similar function with an extra parameter to specify authors to exclude. It's not too big, and most of the code is spent handling options, so it isn't that much duplication.

You could always vote for the existing Trac ticket to get an exclude parameter added in a future version!

share|improve this answer
    
Thanks for adding the Trac reference :-) –  EAMann Oct 7 '10 at 15:19
    
@EAMann: Ah, you didn't have to delete your answer for this! –  Jan Fabry Oct 7 '10 at 15:30
    
We were saying the same thing. No reason to duplicate what was already a good answer. –  EAMann Oct 7 '10 at 15:50
    
@EAMann: But the rep man! Think of the rep! Oh, wait - a diamond next to your name. Nevermind. You're one of those. –  Jan Fabry Oct 7 '10 at 15:57
add comment

I have used the following code to include info from Authors (WordPress users) in a page template. It could be reversed to exclude authors.

<?php
            //display selected users
            $userids_to_display = array(4,221,22,3,5,9,235,236,250); // wordpress user IDs to include
            $blogusers = get_users_of_blog();
            if ($blogusers) {
              foreach ($blogusers as $bloguser) {
                if ( in_array($bloguser->user_id, $userids_to_display) ) {
                  $user = get_userdata($bloguser->user_id);
                  echo '<div>';
                  echo '<div class="alignleft">'.get_avatar($user->ID).'</div>';
                  echo '<div class="user-data"><h3>' . $user->user_firstname . ' ' . $user->user_lastname . '</h3>';
                  echo '<div class="author-description">'.$user->description.'</div>';                
                  echo '</div>';
                }
              }
            }
            ?>
share|improve this answer
add comment

Since it seems there is no way to do this without a custom function, you could use jQuery to find their names and hide them after the list is generated. Something like this:

$('ul.author_list li:contains("John")').remove();

I also found a plugin that can do this for you: List Authors Plus

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.