Please take a look at this example;
$args = array(
'post_type' => 'post',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'movie_genre',
'field' => 'slug',
'terms' => array( 'action', 'comedy' )
),
array(
'taxonomy' => 'actor',
'field' => 'id',
'terms' => array( 103, 115, 206 ),
'operator' => 'NOT IN' //you must set the operator to NOT IN
)
)
);
$query = new WP_Query( $args );
See WP_Query in the Codex for more details;
http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
Related Posts:
- Categories Listing and Highlighting current category item
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Display post category in foreach loop with category link
- Redirect to another page using contact form 7? [closed]
- Display post category in foreach loop
- Excluding posts not working
- Loop doesn’t exclude the specified category in home page
- How to get post with slug and exclude categories
- Exclude post category in a blog page
- Get latest post from categories
- How to display only one category in a custom post type?
- displaying the categories post
- Excluding category from post navigation in WordPress?
- Show a Category Specific Info Box
- Older entries link within a category page
- Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
- how to set beforsend option in wordpress ajax methods
- Add icon/badge next to posttitle of specific category
- List posts in a given category
- Add ajax load more function using WP API
- How to automatically apply a category based on the post title?
- Edit custom post type admin menu link
- Deleted category by mistake, all posts now have categorized category. Can i revert that?
- Direct link to “New post” in specific category?
- How to display category from recent posts?
- How to display WordPress archive into three columns [closed]
- how to get posts ids inside pre_get_posts filter?
- Can I divide the pages into categories?
- Properly display posts on homepage
- Display post X of Y in category
- Get current category id from post page wordpress
- Get mixed category random posts
- WordPress Custom Fields (Checkboxes with multiple values)
- Extracting post categories
- How do I exclude the current post from listing in recent posts
- Child_of not displaying all children posts.. via get_posts
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Saving category to a post, before publishing the post
- Most liked page not displaying posts
- Duplicate posts and change category
- Should I use posts or pages in this scenario?
- How to make number of blog posts a custom field?
- Category Foreach keeps looping?
- Using permalinks, category slugs, and tag slugs
- post categories
- Insert woocommerce products programmatically with featured image and gallery
- Exclude category from
- How to limit posts by category
- how do I get a specific post from a post with a subcategory in WP
- Assign category to new post via URL
- Stop users posting into category while still seeing contents of the category
- Category Page Template not Showing Posts
- display a random post thumbnail from a random category
- How do I retrieve then print the currently viewed sub categories?
- Add multiple tags to multiple posts
- How to allow users to post only in certain category and hide elements from edit page?
- How can i limit the number of posts created per category?
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- Pulling in post category and children within category
- WordPress custom Query for Posts in Category display posts multiple times
- Post categories to pages
- Get user categories with most posts in it
- Post page to display specific category
- Get Posts Under Custom Taxonomy
- Get attachments for posts that belongs to a specific category
- Prevent additional top level categories but allow more children
- Need help with category listing!
- Prepending %category% onto default posts fails
- List all categories with featured image from post?
- Categories list into registration form
- WP_Query: Mixing category__in and tag__in together
- If in_category not working for multiple single.php pages
- How to show only subcategories in parent category not parent category?
- How can I setup a relationship using categories in WordPress?
- WordPress Multisite – Create Default Post and New Category On New Site Install
- Exclude the first ‘n’ number of posts of a tag from home page?
- how to show single post in a custom template
- Creating a post from data returned from HTML form
- Using ajax on editing a category edit page?
- Related posts by category not working right
- How to list recent posts in a wp nav menu?
- Set Default Category to Username
- Disable sticky option for specific categories
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- How can I hide tags on a child-category page, if that tag has not been used?
- date issue with category post retrival
- Custom order for Mysql array
- List authors with the last post title and order by last post date
- Listing Specific Categories from Current Post with Depth
- How to make multiple sections in home pulling posts category wise?
- How to display two blog categories as separate sections on one page?
- How to make the first post in the loop be styled like a “new / featured” post?
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- Single.php – Get Current Parent Category
- How do I stop the loop from repeating in my category template?
- get_the_category listing in hierarchial order
- how to get post order by post id wp_query?
- Is it possible to add/tick a category to a post when it is created?
- Hide posts belongs to few categories in homepage