You are right, it is not possible to pass an array with author IDs to exclude them. The reason is in wp-includes/query.php
at line 2294 – 2298
if ( strpos($q['author'], '-') !== false ) {
$eq = '!=';
$andor="AND";
$q['author'] = explode('-', $q['author']);
$q['author'] = (string)absint($q['author'][1]); // this line select the first ID and only this ID
} else {
$eq = '=';
$andor="OR";
}
You have to get all author IDs, then exclude the unwanted authors and request the posts from the remaining authors
// array for user IDs
$users = array();
// roles to include
$roles = array( 'author', 'editor', 'contributor', 'administrator', 'superadmin' );
// user IDs to exclude
$exclude = array( 2,3,5 );
// get all users
$_users = get_users();
foreach ( $_users as $user ) {
// do not add the user ID if the users role does not match or the users ID is excluded
if ( in_array( $user->ID, $exclude ) || ! in_array( $user->roles[0], $roles ) )
continue;
// add user
array_push( $users, $user->ID );
}
$args = array('author=" . implode( ",', $users );
$newquery = WP_Query( $args );