When building WordPress websites something that I’m asked more and more frequently is whether its possible to hide or remove columns from the posts, pages and custom posts admin screens. The most common requests are to remove the comments column because that particular site doesn’t have comments, or if there is only one author for the website that column may not be needed.
By using the following snippet of code we can do that very easily.
function remove_comments_column( $columns ) { unset($columns['comments']); return $columns; } function remove_column_init() { add_filter( 'manage_posts_columns' , 'remove_comments_column' ); } add_action( 'admin_init' , 'remove_column_init' );
To remove a different column, for example: Author, all we need to do is change line 2 to
unset($columns['author']);
instead.
Simples 🙂