Title: Exclude Ads from Category
Last modified: August 22, 2016

---

# Exclude Ads from Category

 *  [jim7654](https://wordpress.org/support/users/jim7654/)
 * (@jim7654)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/exclude-ads-from-category/)
 * Hello,
 * i wanted to exclude Ads from one category in my blog, but it’s not working. I
   put code in single_news.php, but ad is still there. I tried this codes…
 *     ```
       <?php
       if ( !in_category(categoryId) ) {
       ?>
       (Ad code here)
       <?php } ?>
       ```
   
 *     ```
       <?php if($category->ID != categoryId): ?>
       (Ad code here)
       <?php endif; ?>
       ```
   
 * Can someone please help me?

The topic ‘Exclude Ads from Category’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [jim7654](https://wordpress.org/support/users/jim7654/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/exclude-ads-from-category/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
