Enable/Disable Comments for Posts in a Custom Post Type

Are you looking at managing comment / discussion on a Custom Post Type by Custom Post Type basis?

You can simply add the following to your functions.php or in a functions plugin:

function yst_modify_post_type_supports() {
  remove_post_type_support( 'question', 'comments' );

add_action( 'init', 'yst_modify_post_type_supports', 11 );

The code above assumes question is the slug for the post type you want to disable comments for. If you also want to disable trackbacks and pings, add the following inside the function:

  remove_post_type_support( 'question', 'trackbacks' );

Now of course, coding is not for everyone, so you can do it with a plugin too:

Disable comments for a post type with a plugin

If you don’t want to handle the code, PMC Disable Comments is the perfect solution for this.

Enable/Disable Comments for Custom Post TypesWhile I’m only showing the built-in Post Types for WordPress, any Custom Post Types you have for your site will show up here. These controls will let you manage the default setting for comment discussions when viewing a post in that Custom Post Type view.

Leave a Reply

Your email address will not be published. Required fields are marked *