Home / admin / Remove the comments count column from pages
  • How to Remove the comments count column from pages

    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.

    ( click code to copy )

    wordpress snippet : PHP

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

    ( WordPress codex functions, hooks, in this snippet. )

    manage_pages_columns, add_filter,
  • Pingback: Daily Tip: How to Remove the Comments Count Column From WordPress Pages()

  • ENIX

    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

    • 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

      • ENIX

        @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! :)

        • No problem anytime, I post new snippets everyday so visit often :)

      • naqqash

        not working for me

  • Guest

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

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