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
- MySQL Query to Retrieve Category from wp_posts
- Category checkbox list tree changes when editing a post
- How to query serialized array by comparing greater than (>=)?
- How to sort posts by last name (2nd word) on ONE category only?
- Restrict users from editing post based on the age of the post
- Single.php Active Category Class
- Most efficient way to list all categories and display a post for each of them?
- prevent showing posts of an specific category in admin posts section
- Search widget breaks when using multiple loops?
- Auto set Post to Specific Categories
- How to update serialized post meta?
- New blog template to display only one category
- WordPress menu that shows all posts in a certain category like w3schools
- Filter Posts by Excluding Categories
- How can I list random authors from current post category?
- How do I render all posts of the same category in same layout?
- How to limit displayed posts on wordpress
- WordPress list posts from sub categories
- Select a random post from a specific category?
- Accessing post->ID outside of the loop for listing child pages
- How to filter posts that belong to a specific category only if that is the only category
- Category List (Archive) Page Template By Category
- List posts in a given category
- Child_of not displaying all children posts.. via get_posts
- post categories
- How can i limit the number of posts created per category?
- Get Posts Under Custom Taxonomy
- Prevent additional top level categories but allow more children
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- Remove current category from post but display all others
- How do I show posts from another wordpress installation?
- Get categories names as an array to use it in theme settings
- How do I include the category next to the title of a post?
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- How to get the last category name of a child category?
- How to exclude posts that already appear in the main loop, from the category loop
- Migrate posts from category and sub-category via SQL
- Posts Missing in Dashboard after update
- Display post number by category
- how to make an array of post id’s in is_single
- Loading Posts & Category with Ajax
- array_rand not working correctly?
- Retrieving posts by their date and category
- Are post, page and category IDs unique to each other?
- Static pages not working
- WordPress displays post on subcategory only
- Defining ‘last’ class on foreach blog posts
- Help Combine These Two PHP Codes
- Display hierarchical categories/sub-categories for a single post only
- Merge get_comments & get_posts into a single query
- Author post count in category
- Why do I have categories with duplicate slugs?
- Make sticky post with FacetWP
- Automatic Table of contents with categories and posts
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Is it possible to remove actual post pages in wordpress but keep them in categories
- Need help with hiding an image within a post in a category
- WordPress not showing recent posts
- How to get post count including nested categories
- Get the correct meta_value with get_post_meta
- How to filter out post from a category not its subcategory in wordpress dashboard
- How can I display a specific number of post in a category via a url
- how to chang preview of list of articles of one category?
- Post of a specific category – not to be seen in paging previous/next post
- How to show main category related to that post
- Display selected category on post page
- find posts with exactly 3/4 categories
- Sort post by category using HTML Select tag
- Make assigning post to a specific category equivalent to assigning it to all categories
- How to use in_category?
- About number of posts in selected category
- Displaying only posts from a certain category on my custom page template
- wordpress radio button on single post page
- Category page shows “No Posts” but I do have two assigned
- Multiple blog “feeds” in a single blog each with distinctly styled post pages
- How to get pagination working with “Pending” Posts
- get value from post to sidebar
- Post’s arent displaying
- Show with echo if a post has two or more categories
- How can I get on the same row two post of different categories?
- How to show related posts by detecting the current category?
- Display posts on a custom page from only a specific category?
- Parameter for pagination posts_pagination
- What is the best way to publish News articles?