X

Remove the comments count column from pages

Adding this snippet to the functions.php of your wordpress theme will remove the comments count column from pages admin page.



Code Snippet:


function remove_pages_count_columns($defaults) {
unset($defaults['comments']);
return $defaults;
}
add_filter('manage_pages_columns', 'remove_pages_count_columns');

Comments  Leave a Reply

  1. Kevin, thanks for the share, but i want to edit your original Post. The part of code below absolutely works.

  2. Kevin, thanks for the share but i want to make one small correction to your original Post.

  3. Kevin thanx for this!

    I would like to know if I want it to remove more columns on different parts of the admin area (pages, media, posts) how I would do this? Is there a simple example you could share?

    – ENIX
    The Netherlands

    1. Hi Enix,
      Well if you look on line 3 of the code you will see the name ‘comments’ change that to the name of other columns and it will remove them. However you can also remove multiple by just adding more of the same eg:

      unset($defaults[‘comments’]);
      unset($defaults[‘other’]);
      unset($defaults[‘other’]);

      I did not test all these names however they should work for you.
      cb, title, author, categories, tags, comments, date

      1. @wpsnipp:disqus ,

        thank you, after my first reply I tried it as following and this works fine:

        function remove_pages_count_columns($defaults) {  unset($defaults[‘comments’]);  return $defaults;}add_filter(‘manage_pages_columns’, ‘remove_pages_count_columns’);function remove_media_count_columns($defaults) {  unset($defaults[‘comments’]);  unset($defaults[‘author’]);  unset($defaults[‘date’]);  return $defaults;}add_filter(‘manage_media_columns’, ‘remove_media_count_columns’);

        Again thank you for your work, alot of snippets are very handy! 🙂

        1. No problem anytime, I post new snippets everyday so visit often 🙂

      2. not working for me

  4. Daily Tip: How to Remove the Comments Count Column From WordPress Pages July 26, 2011 at 11:01 am

    […] a little trick I found over at WPsnipp.com from author Kevin Chard. Add this to your functions.php file and it will remove the comments count […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!