Order users by random not working?

Ok, so I found this solution in other thread which did worked: Added this to functions.php: add_action( “pre_user_query”, function( $query ) { if( “rand” == $query->query_vars[“orderby”] ) { $query->query_orderby = str_replace( “user_login”, “RAND()”, $query->query_orderby ); } }); It sorts users by a random order now!