Query posts from an array of categories and their children
-
First, I’ve already checked the WP_Query Codex. I’ve already resigned myself to probably having to do a wpdb query, but here’s my problem:
- If I query a single category ID, it returns all posts in that category and that category’s children.
- If I query an array of category IDs, it returns all posts in those specific categories, but NOT their children.
Like this:
Top Level Category Post 1 Post 2 ->Sub Category Post 1 Post 2 ->Sub Category Post 1 Post 2 -> Sub Sub Category Post 1
Like so:
Top Level Category 1 Post 1 Post 2 Top Level Category 2 Post 1 Post 2 Top Level Category 3 Post 1 Post 2
I need a way to query the equivalent of the first example with several top-level categories and their children, but grouped separately in an array (e.g. array(group1, group2, group3))
Like so:
Top Level Category 1 Post 1 Post2 ->Sub Category Post 1 Post 2 Top Level Category 2 ->Sub Category Post 1 ->Sub Category Post 1 Top Level Category 3 Post 1 ->Sub Category Post 1
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Query posts from an array of categories and their children’ is closed to new replies.