1

I'm looking for the way to disable user column (posts and role) from users list. like you see in the picture enter image description here

I'm also search how to disable column author on page list (in red on the picture) enter image description here

4

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" />
 *      [title]     => Title
 *      [author]    => 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.

Screen Options Open

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.