i had a similar issue, where i wanted to show different subcartegories inside a main category
- shoes
- men
- shoes men
- women
- shoes women
so inside shoes i wanted to show both men and women shoes whilst non of these items should be required to be in category shoes..
your tax_query might be correct but you have to look inside your query for more query variables.
use echo '<pre>', print_r( $query ), '</pre>';
inside your pre_get_posts
function.
in my case, the very first entry was [product_cat] => shoes
so i wrote unset( $query->query_vars['product_cat'] );
to remove that entry, and that worked on my end.
Related Posts:
- is_category() in pre_get_posts strange error
- Rearranging posts based on categories
- is_category in pre_get_posts results in php notices
- If newest post of category is newest post in general, skip first post of category
- Include posts from feature category in pre_get_posts
- Category param redirect to post type archive
- How to get related tags based on a category?
- Is there a reason I cannot get the current category in a loop?
- Editing Loop So It Targets Specific Tags?
- Conditional category query breaking?
- Category name for all posts getting assigned to a single random post
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- Display all categories but only if they have posts in them that have a specific tag assigned
- how tho change number of posts in loop from specific categories
- Querying posts from two different categories while looping inside another loop
- How to add an empty entry to masonry?
- Loops in category description
- Category slug in in loop always the same?
- Detecting top parent category fails on home page
- Is There a Difference Between Taxonomies and Categories?
- Get the children of the parent category
- What is the difference between a “tag” and a “category”?
- How to check if I’m on the last page of posts?
- Can’t custom taxonomies have same terms (slugs) as categories?
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Should category.php and The Loop be used if the query needs to be customizable?
- How do the ‘tag’ and ‘category’ (default) taxonomies do ‘save_post’ action?
- Control term order on a per-post basis
- get all tags from category
- 404 Error On Category and Tags Pages
- Exclude the category from the WordPress loop
- How do I get the category URL from get_the_category?
- Checklist of selected categories
- pre_get_posts with get_posts
- Rewrite URL with category and tag combined using WP_Rewrite
- get_field not displaying my custom field value
- Default WP Gallery – show only galleries of a certain category
- How to tax query X number of posts related by tag first, then by category if not enough in tag-related
- Use tag interface for hierarchical taxonomy?
- WP_Query not looking at child category
- Sort posts by tags in category pages
- Randomise results from a category page?
- How to search for categories and/or tags?
- Using URL parameters, list posts from category and custom taxonomy
- Display all posts in category, with specific tag posts at top
- How to get the url to tag & category base set by the user?
- Show div only if post is in specific category
- Filter categories using tags
- Sticky posts on home page, search, tag and archives without plugin
- How to show a category post to a specific registered user
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Category and tag with same name
- Display list of Sub-Categories and the posts they contain, within one main Category
- Create subdomains for tags and categories
- Loop with Dynamic Categories
- In the tag archive – display count of posts for each category they belong to
- Is it possible to disable certain user roles from creating tags?
- Automated adding of one tag to all the posts in a category
- WordPress Number of Posts Not Changing With posts_per_page
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Moving Categories submenu to Media, but still opens Posts menu
- Remove child products from woocommerce category page [closed]
- Get a list of commas separated categories inside a loop
- How do I edit pre_get_post for the category the user is currently in?
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- Exclude most recent posts from specific category in wp_query()
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- How to exclude categories from recent posts, recent comments & category widgets?
- Custom Query to search through categories
- How to totally get rid of Category in my blog?
- Root level category, tag, author and archive pages to work
- How to query all posts of a specific category, and any other category combination
- Listing all posts from current category on page
- Query the Loop without breaking it
- Showing all the posts in one page?
- Categories and Tags returning 404 on the sidebar when using ugly permalinks
- Display one latest post from multiple categories
- How to Check if a Child Category is Being Queried
- Deleting All tags except categories Wp database
- How do I get the total number of categories in a list of search results?
- Is it possible to put tags and category information in the post as text?
- Script to duplicate categories as tags
- Check if post belongs to any category
- Search by word, category, tag, author
- Remove Categories and Tags from Admin Dashboard
- How do I display the posts from a custom post type on a category.php page?
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- How to group the loop posts in a particular by author?
- How to filter archives both by category and tag?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- display most popular tags of category?
- Get tags specific category
- Display products for a category, sorted by post_excerpt
- Can paginate_links() be customized for a specific category or tag?
- How Do I Merge Categories With phpMyAdmin
- Exclude category from loop not working
- Any way to assign Post Categories and Tags to Links?
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Category vs Tag vs Table