You can use the manage_{$screen->id}_columns
hooks for this.
To manage user columns we can use manage_users_columns
which is passed an array of columns and whatever we don’t want we can unset()
.
/**
* Manage User Admin Display Table Columns
*
* @param Array $columns
* [cb] => <input type="checkbox" />
* [username] => Username
* [name] => Name
* [email] => Email
* [role] => Role
* [posts] => Posts
*
* @return Array $columns
*/
function wpseq_270133_users( $columns ) {
unset( $columns['role'] );
unset( $columns['posts'] );
return $columns;
}
add_filter( 'manage_users_columns', 'wpseq_270133_users' );
Pages is a very similar fashion but instead of a users
hook we need to specify pages
:
/**
* Manage Pages Admin Display Table Columns
*
* @param Array $columns
* [cb] => <input type="checkbox" />
* disable column on post and user list => Title
* => Author
* [date] => Date
*
* @return Array $columns
*/
function wpseq_270133_pages( $columns ) {
unset( $columns['author'] );
return $columns;
}
add_filter( 'manage_pages_columns', 'wpseq_270133_pages' );
There’s also checkboxes under Screen Options to remove these columns for yourself whenever logged in, the above code will hide these columns from every role.