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
- How to get the number of posts in a selected category?
- Publish pending article from front end with a button?
- Show related posts by category but ignore one category
- How to display related posts from parent category
- Add custom field to category of custom post type
- Can I hide a specific post from latest posts page?
- How to show post(excerpt) from specific category on wp page?
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Advanced Custom Fields – Storing array value for further usage
- Custom Theme Want To Remove One Category From All Displays
- Filter Posts by Excluding Categories
- Divide Loop Into Days & Categories
- Different template for posts of all subcategories of category
- How to limit displayed posts on wordpress
- Mark menu item as current-menu-item for category
- How to set up multiple taxonomies for groups of posts
- How to display category from recent posts?
- how to get posts ids inside pre_get_posts filter?
- Can I divide the pages into categories?
- Duplicate posts and change category
- Category Foreach keeps looping?
- display a random post thumbnail from a random category
- Post page to display specific category
- Exclude the first ‘n’ number of posts of a tag from home page?
- how to show single post in a custom template
- 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?
- Latest posts by category — how to exclude current post?
- 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?
- Use posts_where to exclude posts ids from wp_query
- 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
- Remove Featured Image from posts in specific category?
- Adjust the order for returned posts
- Defining ‘last’ class on foreach blog posts
- Help Combine These Two PHP Codes
- Display hierarchical categories/sub-categories for a single post only
- Post in bulk based on category template
- 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
- Is it possible to remove actual post pages in wordpress but keep them in categories
- WordPress text field in array problem
- 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
- 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
- Use radio buttons & checkboxes for post categories
- List posts that are in the same category as the current post title
- 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?
- Sort Posts Alphabetically Based on Specific Category (Divi)
- I have a website issue I am trying to resolve
- How to sort posts alphabetically based on a specific parent category