I want to show posts from a custom post type that have a term from one taxonomy but exclude posts that have a term from another taxonomy.
show all posts from a given post type that have a term named ‘A’ with a value of ‘foo’ from a taxonomy named ‘taxonomy 1’ but exclude any posts which also have a term named ‘B’ with a value of ‘bar’ from a taxonomy named ‘taxonomy 2’
can I perform this type of query by passing an array to wp_query or do I have to write a SELECT statement and query the database directly?
The taxonomy query examples on the wp_query use ‘relation’ such as “AND” and ‘operator’ such as “NOT IN” to refine a query but it is not clear to me how to use these in an array to build my query for wp_query.
- The topic ‘wp_query exclude taxonomy’ is closed to new replies.