I don’t see an “orderby Rand()” parameter for either get_users
or WP_User_Query
. There is a filter called pre_user_query
that could be used but I am not sure I see the benefit of that when shuffle
will randomize the array you already have.
$args = array(
'fields' => 'all_with_meta',
'exclude' => array(1),
);
$users = get_users( $args );
shuffle($users);
var_dump($users);