Title: Exclude Category From Loop
Last modified: February 12, 2021

---

# Exclude Category From Loop

 *  Resolved [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/)
 * Is it possible to exclude a specific category from the loop? I’ve tried using
   compare=not, eg:
 * [loop type=post category=whatever compare=not]
 * But it doesn’t seem to work.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14041879)
 * Try:
 * [loop type=post taxonomy=category term=whatever compare=not]
 *  Thread Starter [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14041893)
 * Perfect, thanks!
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14041938)
 * Please mark as solved
 *  Thread Starter [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14051475)
 * Actually I had a follow up question if you had any ideas. It works on it’s own
   but when combined with a field it seems to break, eg:
 * [loop type=post field=myfield value=’myvalue’ taxonomy=category term=whatever
   compare=not]
 * The loop works when using just one or the other but when combined the output 
   isn’t right. I’m guessing it’s the compare=not? I tried adding _2 but neither
   worked:
 * [loop type=post field=myfield value=’myvalue’ taxonomy_2=category term_2=whatever
   compare_2=not]
 * [loop type=post taxonomy=category term=whatever compare=not field_2=myfield value_2
   =’myvalue’]
 * Also tried defining the compare:
 * [loop type=post taxonomy=category term=whatever compare=not field_2=myfield value_2
   =’myvalue’ compare_2=equal]
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14053528)
 * Have you tried:
    `[loop type=post field=myfield value=’myvalue’ and taxonomy=
   category term=whatever compare=not]`
    -  This reply was modified 5 years, 2 months ago by [polarracing](https://wordpress.org/support/users/polarracing/).
 *  Thread Starter [baldidiot](https://wordpress.org/support/users/baldidiot/)
 * (@baldidiot)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14053694)
 * Thanks for the help, most appreciated. No luck with that though, unfortunately.
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14053884)
 * For me this works. Needed to test with checkbox, but should not behave differently
   when used with field
 *     ```
       [loop type=instructor checkbox=mr_racing_show value='touring' and taxonomy=instructor_cat term=coach_cat-de compare=not]
       [field link]
       [/loop]
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Exclude Category From Loop’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [polarracing](https://wordpress.org/support/users/polarracing/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/exclude-category-from-loop-2/#post-14053884)
 * Status: resolved