Title: Remove comments in specific categories
Last modified: August 20, 2016

---

# Remove comments in specific categories

 *  Resolved [Chris](https://wordpress.org/support/users/chips/)
 * (@chips)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/remove-comments-in-specific-categories/)
 * I am trying to write a function in my child theme that will remove the comments
   on all pages and posts apart from posts in a category called ‘blog’.
 * Here is what I have. The file ‘no-comments.php’ is completely empty;
 *     ```
       function remove_comments( $file ) {
       	if ( !in_category('blog') )
       		$file = STYLESHEETPATH . '/no-comments.php';
       	return $file;
       }
       add_filter( 'comments_template', 'remove_comments');
       ```
   
 * It works except that when viewing the posts in the ‘blog’ category, the link 
   to view comments doesn’t work anymore. Does anyone have any ideas as to what 
   the problem could be?

Viewing 1 replies (of 1 total)

 *  Thread Starter [Chris](https://wordpress.org/support/users/chips/)
 * (@chips)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/remove-comments-in-specific-categories/#post-2195000)
 * Solved. I removed a plugin which must have been conflicting with the function.

Viewing 1 replies (of 1 total)

 The topic ‘Remove comments in specific categories’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [Chris](https://wordpress.org/support/users/chips/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/remove-comments-in-specific-categories/#post-2195000)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
