custom post types – Is it possible to make is_category() recursive?
In resetting the main query for category pages for a custom post type, I would like to write one test for a parent category and have it test positive for all child categories, recursively.
For example, if the category is Lumber, I am resetting the main query to pick up data in a Custom Post type for lumber.
Currently, the code looks like this:
if (!is_admin() && $query->is_main_query() && (is_category('Lumber') || is_category('Domestic Hardwoods')) )
While I can add all the subcategories manually, it would mean inconvenience for my client if they wish to add a new subcategory. Recursion should fix that UX problem.