How to Disable and Hide Comments on Posts of specific categories

In this tutorial I will share a simple snippet which allows you to disable / hide comments on Blog Posts of selected categories.

The snippet is quite simple and does two things

1) It first checks if the post belongs to disabled categories. The check is done after the post object is completely created.

2) In case the post belongs to disabled category, the code uses comments_open() filter to close the comments on the particular post.

Read more