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?
- What is the difference between a “tag” and a “category”?
- How to check if I’m on the last page of posts?
- get all tags from category
- Checklist of selected categories
- In the tag archive – display count of posts for each category they belong to
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- Exclude most recent posts from specific category in wp_query()
- How to exclude categories from recent posts, recent comments & category widgets?
- Listing all posts from current category on page
- Query the Loop without breaking it
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Category vs Tag vs Table
- How to find the number of Tags a post has?
- How to not treat categories as tags in feeds
- Why would in_category only return one post in a specific category?
- Disallow categories from this MySQL query
- Are Category or Tag Archive Pages Possible?
- Display tags from specific category in select fields
- Offline WordPress Application
- Find out which user created a category or tag?
- How to make 2 tag feeds show up on 1 page?
- Taxonomy name repeating when showing 2 posts from each category
- Different templates for different category tags
- Display the last post by each category?
- Get link which associated with a specific category and tag
- Check if loop has any categories?
- Multiple Loops on category.php with pagination on last loop
- How to exclude the last post from a category(featured for example) from the main loop?
- How to get latest posts from each category in regular order
- menu using category and tags
- ajax for filtering posts by category in wordpress loops
- limit a list of tags to one category [closed]
- How to query categories with Advanced Custom Fields?
- Limit get_categories to show each category once
- Show Posts from Single Category Not Working
- new WP_Query all post in a category inside the loop
- Problem with different query loops (and “main loop”) on category template page!
- How to add orderby parameter for sorting on category.php
- Exclude category from query
- How to loop custom post_type from (a) specific category(ies)?
- Category tags with comma’s
- Display posts of certain categories to specific user roles
- Limit tags shown in post
- Tags Instead of Category
- Category nicename inside loop in wordpress
- filter a loop base on specific category
- custom query for both category and pages using global $wpdb;
- Query from multiple category (and)
- Pretty URLs with Categories and Tags
- Autolinking keywords in text with tags
- Get current taxonomy and display query accordingly
- Posts made to category don’t show up (do show up on frontpage)
- Hide specific category tag on single post page
- Filtering posts in category by tag URL
- How to show entries related to main category
- Please tell how to stop the category from showing up on posts
- Loop by category and meta_key
- Get category from slug list
- Re-coding category-template.php to go to custom URL
- Assign a class to first element in category in loop
- Tag Menu items based on their categories
- Hide category name using mod_rewrite
- Category page shows only 1 post when that post has more than 1 category?
- Is it possible to query the result of a query?
- How can I modify this code to iterate over an array of categories?
- How to exclude a specific categogy from a custom page template
- htaccess redirect for all categories converted to tags now showing 404
- altering theme – content generated by PAGES not PORTFOLIO
- Get query result before posts are displayed?
- My Query is getting the wrong data
- Search tag within category
- How to use Greek characters/letters in a query?
- How do i add custom post types to this query?
- Custom WordPress category page showing all posts rather than the specified category
- Do not show all post from all categories, just show posts from category in current loop
- Echo Category In Loop
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing