• I have this code in a template I am using. It displays users by contributor role and works well. There are a couple of users I would like to exclude but each time I try to modify this code the author page breaks.

    Is there an easy way of excluding contributors by id without make huge changes to this code?

    $mvp_users = get_users(‘role=contributor&orderby=display_name&order=ASC’); foreach($mvp_users as $user) { $post_count = count_user_posts( $user->ID ); if($post_count < 1) continue; ?>

Viewing 1 replies (of 1 total)
  • Hello,

    You should be able to use exclude parameter of get_users function like this:

    $mvp_users = get_users('role=contributor&orderby=display_name&order=ASC&exclude=23,54,67');
    foreach( $mvp_users as $user ) {
        $post_count = count_user_posts( $user->ID );
        if($post_count < 1) continue;
    }

    You would replace 23,54,67 with your own IDs of course.

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Exlcude users by id?’ is closed to new replies.