Title: loop exclude field value
Last modified: August 31, 2016

---

# loop exclude field value

 *  [petroglyphic](https://wordpress.org/support/users/petroglyphic/)
 * (@petroglyphic)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/loop-exclude-field-value/)
 * I have a loop: `[loop type=profiles taxonomy=profile-type term=witw field=school_year
   value=2015-2016]`. Gets all profiles whose profile-type is “witw” and whose school_year
   value is “2015-2016”. School_year is a custom field.
    I need a second loop which
   gets all profiles whose profile-type is “witw” _except_ those whose school_year
   value is “2015-2016”. I’ve tried: `[loop type=profiles taxonomy=profile-type 
   term=witw relation=and taxonomy_2=school_year value_2=2015-2016 compare_2=not]`,`[
   loop type=profiles taxonomy=profile-type term=witw compare=not field=school_year
   value=2015-2016]`, and every other combination I can think of. I either get all
   the “witw” posts or none of them. I’m guessing it’s something about the syntax
   with a taxonomy and a field value, because I have another loop (which you sent
   me several months ago) that does this with two taxonomies which works fine, but
   I can’t figure this one out. Thanks, Susan
 * [https://wordpress.org/plugins/custom-content-shortcode/](https://wordpress.org/plugins/custom-content-shortcode/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/loop-exclude-field-value/#post-7156169)
 * Hello,
 * I see, you found an overlap between taxonomy and field value _compare_ parameters.
   Because of the combination, _compare=not_ was being applied to both. This is 
   actually a design flaw in the syntax.. To get around this issue, I added _tax\
   _compare_ and _field\_compare_ parameters, to differentiate the two queries.
 * So, I think the following should work: `[loop type=profiles taxonomy=profile-
   type term=witw field=school_year value=2015-2016 field_compare=not]`

Viewing 1 replies (of 1 total)

The topic ‘loop exclude field value’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/loop-exclude-field-value/#post-7156169)
 * Status: not resolved