Paulund
2013-08-28 #wordpress

Remove Column On Pages Table In WordPress

When you install some plugins they may add additional columns to the posts and pages table. Just like the Yoast SEO plugin, it's a great plugin but I don't need that information to be on the post table. Here is a code snippet that will allow you remove any of the columns you want from the pages and post screen. WordPress has two filters that you can use to manage these columns manage_pages_columns and manage_posts_columns. When you use these filters you will have all the columns in an array so you can simple unset them to remove them. These are the default columns you will have.


Array
(
    [cb] => <input type="checkbox" />
    [title] => Title
    [author] => Author
    [categories] => Categories
    [tags] => Tags
    [comments] => <span class="vers"><div title="Comments" class="comment-grey-bubble"></div></span>
    [date] => Date
)


function remove_post_columns($columns) {
  // Remove the checkbox
  unset($columns['cb']);

  // Remove the Author
  unset($columns['author']);

  // Remove comments column
  unset($columns['comments']);

  return $columns;
}
add_filter('manage_posts_columns', 'remove_post_columns');

You can do something very similar for the pages table by using the manage_pages_columns. The default columns you have on this screen are:


Array
(
    [cb] => <input type="checkbox" />
    [title] => Title
    [author] => Author
    [comments] => <span class="vers"><div title="Comments" class="comment-grey-bubble"></div></span>
    [date] => Date
)


<?php
function remove_pages_columns($columns) {
  // Remove checkbox column
  unset($columns['cb']);

  // Remove author column
  unset($columns['author']);

  // Remove comments column
  unset($columns['comments']);
  
  return $columns;
}
add_filter('manage_pages_columns', 'remove_pages_columns');
?>