Try adding include_children
parameter as false
to your first example (tested):
$args = array(
'post_type' => 'workshops',
'posts_per_page' => -1,
'fields' => 'ids',
'tax_query' => array(
array(
'taxonomy' => 'workshop_categories',
'field' => 'slug',
'terms' => array( 'crafts', 'jewellery' ),
'operator' => 'AND',
'include_children' => false,
)
)
);
$posts = get_posts( $args );
Unfortunately I can’t explain why, but that was necessary for my test to work.
Related Posts:
- tax_query in get_posts() not working?
- Using get_posts() with tax_query parameter set isn’t working with attachments
- How to organize and cache additional data associated with terms?
- get_terms with posts that have a different taxonomy with term x
- tax_query: What to pass when I want to have all terms?
- Exclude posts which have any term in a certain taxonomy from the query
- How To Query For An Empty Taxonomy Field
- Can I create a tax query to return posts that match two slugs from same taxonomy
- $product->ID in has_term() not working, but manually inputting the ID works, why?
- How to perform unit testing on proposed patches in Trac?
- Can the default “post tags” taxonomy be renamed?
- Remove the category/taxonomy description field?
- Add ‘Description’ to taxonomy ‘Quick Edit’
- get a specific taxonomy term name
- get_terms() How many is TOO many?
- Child Terms not Displaying on the Taxonomy Term Admin Screen
- How to display child term of current term’s parent taxonomy?
- Sorting custom taxonomy causes menus error
- How to add terms to taxonomy with wp_insert_terms?
- Is there any difference between post in child term and child & parent terms?
- How to add automatically keyword to taxonomies when a post published, and assign them to the post
- Display Custom Taxonomy in Sidebar in Two Columns
- Create and move terms for taxonomies
- Display parent taxonomy name and list child taxonomies below it?
- How can I remove links from the function “get term list”?
- Alphabetical order in taxonomy.php
- Get Term names from WP Term Object
- functions to create term and child terms
- base directories / URL
- WordPress REST get all items without a taxonomy assigned
- Getting the parent from the wp_term_taxonomy
- How do I get the current tag out of a taxonomy?
- If search matches taxonomy
- How to list 2 taxonomy terms for a post, based on their hierarchy
- Showing custom taxonomy column in taxonomy category listings immediately after create category
- Custom Field as Custom Taxonomy?
- Taxonomy archive showing no results
- Order wordpress taxonomy parent terms by their children count
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- how to show only last child terms of a taxonomy
- Modify the query method when adding category filtering function to the custom post list
- How to list taxonomy terms in reverse order?
- need to get postthumnails from a post whithin a category custom post type
- Adding tag’s featured image to tag archive
- Group Post by Custom Taxonomy 2 under Custom Taxonomy 1
- Individual post. Meta_key, taxonomy or post status for separation?
- Taxonomy archive page WP_Query does not return get_the_permalink() or get_permalink() value
- Ordering Taxonomies / Changing term_id
- How to show taxonomy image instead of taxonomy name on a list
- benefits of the table ‘wp_term_taxonomy’
- How to save a multiple checkbox array into a non-hierarchical taxonomy
- `get_terms()` with `child_of` and `childless` combined
- Add text to the end of each list item in wp_list_categories
- echo term name outside the loop, using term slug
- What are these undocumented arguments for register_taxonomy?
- Dynamic filtering of posts with custom taxonomies
- Sorting tags by name
- Modify output of wp_dropdown_categories to add term IDs to each option
- How to get terms from a custom taxonomies after WordPress 4.5.0
- Search Media by taxonomy
- Get Taxonomy name from “registered_taxonomy” hook
- In two-category searches, where does WordPress save the title of the 2nd category?
- Show only first child in dropdown
- Display posts from tagchildren of taxonomy tagparents
- Custom Post Type + Custom Taxonomy = Archive Listing Page Problems
- Taxonomy term archive default loop returns 1 record instead of 8
- Related terms – Terms that feature in post of current term
- Bug using wp_insert_term with switch_to_blog
- Select query with two and two related taxonomies
- Get something out from taxonomy
- Taxonomy Dropdown Question
- get_term_by with a variable
- Customize menu link for taxonomy in WP menu
- Change searching from world level to first letter
- Is possible hide hierarchical select dropdown created by jetsmartfilters? (only visual issue)
- How to have article URL like example.com/article1 and example.com/foo/article2?
- I want to edit the tags template by adding text that displays all tags from the listed posts
- Add specific content to a taxonomy results page
- Set the limit of taxonomy per page
- echo a tax term in loop
- tax_query not working?
- How to manage the links of a new taxonomy
- Same page for startpage and archive?
- Get taxonomy url, name, post count & image
- Rewrite permalink to include multiple taxonomies
- how to print post tags [duplicate]
- Filtering posts by taxonomy and meta_value
- What to do with shared terms splitting in WordPress 4.2?
- Related Posts by taxonomy using Advance Custom Fields Plugin
- How to get a query odered by N of matching taxonomies?
- Get the tax term in which is a post via wp_query
- Advanced AND tax_query in sidebar with 2 taxonomies
- Custom Taxonomy Page redirect 404
- Child Terms not Displaying on the Taxonomy Term Admin Screen
- multiple taxonomies in wp_list_categories’ $args
- Why is taxonmy-[taxonomyname].php not working?
- tax_query not working properly with get_posts
- How to orderby Taxonomy Term in a WP Query
- Using autocomplete with post_tag taxonomy on attachments
- How reorder post tags taxonomy in the non-alphabetical custom order and save it in the Block Editor