WordPress Taxonomy Hierarchy – Hiding Children

I have a hierarchical taxonomy like this:

CATEGORY 1
  SUB CAT 1

Product A is in Sub Cat 1

Read More

Product B is in Category 1 and Sub Cat 1

By default, WordPress is going to show me both products when I’m browsing Category 1. I’ve written a function that will hide the products that are in sub-cats, but what I really want to do is to get a list of all the products that are in Category 1. If I use get_objects_in_term() it pulls everything in the parent and children.

Any ideas to get only the products that are actually a part of Category 1?

Related posts

Leave a Reply