title: Excluding Specific Terms from WP_Query
body: <p>I would like to create a foreach loop for taxonomy terms which is for custom post type.</p>
  
  <p>More specifically I want a loop that queries all the products categories, but not the category "special-offers" and not categories subcategories. Bonus would be if, product has no category query them too and order all of them in ASC order (Not like sort products and categories separately. All of them must be sorted at the same time).</p>
  
  <p>So what should I do with my code to make it work as needed?</p>
  
  <p>Current code:</p>
  
  <pre><code>&lt;?php
  
  $args = array(
      'post_type'    =&gt; 'products',
      'showposts'    =&gt; -1,
      'post_status'  =&gt; 'publish',
      'parent' =&gt; 0,
      'hide_empty' =&gt; true,
      'tax_query' =&gt; array(
          'taxonomy' =&gt; 'categories',
          'field'    =&gt; 'slug',
          'terms'    =&gt; array( 'special-offers', 'other-terms' ),
          'operator' =&gt; 'NOT IN',
      ),
  );
  
  $terms = get_terms('categories', $args );
  
  foreach ( $terms as $term ) :
  
      echo '&lt;h2&gt;' . $term-&gt;name . '&lt;/h2&gt;';
  
  endforeach; 
  
  ?&gt;
  </code></pre>