2

Is there a way (hacks, plugins…) to completely disable comments in WP?

By this, I mean completely hiding the feature from view automatically, for existing and new users alike. In particular:

  • the WP admin bar and menu
  • the posts, pages and medias list, their screen options, and their filters
  • the post, page and media editor and their screen options
  • the widgets screen
  • the applicable settings screens

And of course, disabling the functionality.

I've run into a variety of aging hacks to do part of this, namely and mostly code to disable meta boxes and a handful of hacks to auto-disable comments. I'm turning to SO in the hopes that some web designer or developer might have the entire set of features on hand.

If not, might there be new APIs from the past 3-4 years that make the process simpler (my WP skills are getting rusty), or is seeing it through going to be an awkward output buffer manipulation-related hack?

  • Asking for plugin recommendations is off-topic since a while, Denis. I know that Bultge has one with almost the same name as the title of this Q. – brasofilo Oct 28 '13 at 23:08
  • @brasofilo: I realize this is cosmetics, but… better? If not, can you recommend a venue? – Denis de Bernardy Oct 28 '13 at 23:13
  • 1
    Google+ communities is a nice place, especially with such detailed description... anyway, by Bultge I meant this – brasofilo Oct 28 '13 at 23:19
  • On a second thought, it'd be a nice Q to have around if someone posts the full coding technique. – brasofilo Oct 28 '13 at 23:21
  • @brasofilo: please add that link as an answer so newcomers from Google spot it more easily. (It's not perfect, but the plugin outlines everything I needed. Thanks!) – Denis de Bernardy Oct 28 '13 at 23:27
2

The following is the list of hooks used by Frank Bultge's plugin Remove Comments Absolutely:

# Set the status on posts and pages - is_singular ()
add_filter( 'the_posts', array( $this, 'set_comment_status' ) );

# Close comments, if open
add_filter( 'comments_open', array( $this, 'close_comments'), 10, 2 );
add_filter( 'pings_open', array( $this, 'close_comments'), 10, 2 );

# Change options for dont use comments
# Remove meta boxes on edit pages
# Remove support on all post types for comments
add_action( 'admin_init', array( $this, 'remove_comments' ) );

# Remove menu-entries
add_action( 'admin_menu', array( $this, 'remove_menu_items' ) );

# Add class for last menu entry with no 20
add_filter( 'add_menu_classes', array( $this, 'add_menu_classes' ) );

# Remove areas for comments in backend via JS
add_action( 'admin_head', array( $this, 'remove_comments_areas' ) );

# Remove comment entry in Admin Bar
add_action( 'wp_before_admin_bar_render', array( $this, 'admin_bar_render' ) );

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.