Disable comments for specific post types

The code snippets below should be pasted into your child theme's functions.php file.

WordPress has a meta box to enable or disable comments on specific pages or posts, but there is no option to disable comments globally, or for a specific post type.

Here is how to disable comments for all pages.

// Disable comments on pages.
add_action( 'init', 'example_remove_page_comments' );

function example_remove_page_comments() {

  remove_post_type_support( 'page', 'comments' );

To disable comments, replace page with the post type name for which you would like to disable comments.