WordPress Multisite Email Hider

Virginia recently passed some FOIA legislation (and even more legislation) that says essentially that institutions can’t release student emails without written consent. That includes student directories and other fairly traditional things done with student emails.

It led us to look at our WordPress multisite install.1 While a VCU email address is required to sign up for rampages.us, the username can be whatever the person desires. Emails aren’t visible in the user directory. The one place we thought emails would be visible in way that might be unexpected was in the user view of individual sites. If a student is an admin, they’d be able to see the emails of other student users on that site.

The following bit of code removes the email column from the users view for everyone that isn’t a super admin.

function remove_users_columns($column_headers) {
            global $current_user;
            $super_admins = get_super_admins();         
            if ( is_array( $super_admins ) && in_array( $current_user->user_login, $super_admins ) ){
                return $column_headers;
            else {
             return $column_headers;


If we see an uproar from teachers about the missing column, we can also add people by user ID by doing something like . . . 2

$ok_people = [1,2,4];
if ( is_array( $super_admins ) && in_array( $current_user->user_login, $super_admins ) || in_array($current_user->ID, $ok_people) ){

1 Overkill? Happy to oblige.

2 I didn’t test this yet so …