List only child categories a post is in, of a specific parent category
I would personally create three custom taxonomies rather than do this with categories/subcategories, then this becomes a non-issue. To do this with categories/subcategories, start with the names/IDs of your parent categories, and loop over each parent, then within that, loop over the terms associated with the post and check the term’s parent ID against the … Read more