The following snippet of code will disable comments on your WordPress site everywhere except for on your single blog posts.

// DISABLE COMMENTS EVERYWHERE EXCEPT FOR ON BLOG POSTS
function blog_post_comments_only( $open, $post_id ) {
    $post_type = get_post_type( $post_id );
    // allow comments for blog posts
    if ( $post_type == 'post' ) {
        return true;
    }
    // disable comments for all other post types
    return false;
}
add_filter( 'comments_open', 'blog_post_comments_only', 10 , 2 );

Add that to your functions.php file and you are good to go.

Leave a Reply

Get in Touch

Please fill out the form below and we will get back to you ASAP

  • This field is for validation purposes and should be left unchanged.