joloshop
joloshop

Reputation: 5

custom query for taxonomy

I am using this query to show certain posts.

query_posts( array(
                    'post_type' => APP_POST_TYPE,
                    'post_status' => 'publish',
                    'posts_per_page' => 4,
                    APP_TAX_STORE => $term->slug,
                    ),                      
                ) );

Now instead of showing all posts from APP_TAX_STORE => $term->slug I would like to exclude them. I tried all solutions found in this form, but nothing worked. Any Ideas?

Upvotes: 0

Views: 43

Answers (1)

Sally CJ
Sally CJ

Reputation: 15620

You can use tax_query.

query_posts( array(
  'post_type'      => APP_POST_TYPE,
  'post_status'    => 'publish',
  'posts_per_page' => 4,
  'tax_query'      => array(
    array(
      'taxonomy' => APP_TAX_STORE,
      'field'    => 'slug',
      'terms'    => $term->slug,
      'operator' => 'NOT IN',
    ),
  ),
) );

Upvotes: 1

Related Questions