1

Is there a way to hide the comments column in the backend? When you look at the pages, there's a comments column even though I've disabled them.

I made WordPress into a CMS and it may cause some confusion.

2

Try this:

add_filter("manage_edit-page_columns", "my_page_edit_columns");

function my_page_edit_columns($columns){
  unset($columns['comments']);

  return $columns;
}

If you need it for posts instead of pages, use manage_edit-post_columns instead. The same goes for any post type, really, as manage_edit-{post_type}_columns.

  • Thanks. Is there a way to do this via a plugin or something. I know should we turn the comments back on in the future it will cause an issue doing it via code. – Rob Jun 14 '11 at 13:44
  • 1
    @Rob I'm not sure there's a plugin out there for this specifically. Perhaps you can make your own containing this code? See wpcandy.com/teaches/how-to-create-a-functionality-plugin for a good walkthrough. – helenhousandi Jun 14 '11 at 13:55
  • Haha, think that may be a bit beyond me!! – Rob Jun 15 '11 at 8:12
  • 1
    @Rob You can do it! Give the walkthrough a shot. It's really not that bad to take it back out of the theme's functions.php file later on if comments are turned back on, if you just want to try it out. Just be aware that if it's in functions.php, if you change themes or it gets upgraded you will probably lose the functionality. Think of this as a great way to expand your skills :) – helenhousandi Jun 15 '11 at 15:42
0

Another way to ensure that the comments column is removed from all Post types and not just Pages, use the following instead:

add_filter( 'comments_array', 'wpse_19986_existing_comments', 10, 2 );
function wpse_19986_existing_comments( $comments ) {
    $comments = array();
    return $comments;
}

You can also look into the Disable Blogging plugin which extensively disables the comment functionality among other blog-related features that are needed when using WordPress as a static CMS.

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.