Associating a Taxonomy Term With Another Taxonomy

I have a set of category terms: A and B. Let’s say I habe another taxonomy called “Tax_B” with the term Term_B. Is it possible to associate the two category terms A and B with Term_B so that all posts under A and B would also be categorized under Term_B?

Asking because I’m thinking of importing content from another CMS which does have this type of relationship and I want to replicate it as much as possible. Would like to know if this could exactly be replicated?

2 Comments
  1. You can have parent and child categories – so ‘Mum Cat’

    Then ‘mum->cat_a’, ‘mum->term_a’ etc.

    Cat_a etc. can then also have child cats.

    And/or you can have cats and tags. So something is cat_a and has tag_a.

    WP can fetch all ‘cat_a’ all ‘term_a’ all ‘tag_a’ and all mixes (a and b – a or b etc.) with default behaviour.

    If you want truly separate categories – or truly separate post types – that are ALSO related, you should look at PODS – which allows you to define relationships like this.

  2. Like the other commenter said, add-ons can help you do this.

    ​

    Another idea: terms have meta fields just like posts if that helps.

    Another idea: I maintain a plugin where I duplicate data in terms and post meta, so you could do the same thing with terms. When a term relationship is created or deleted, also create or delete this other term relationship. It also works in the reverse, so if the post meta value is changed, the term relationship is updated. My plugin post type is cars, and so I have taxonomies for Year, Make, Model, etc. I mirror those terms, 2010, GMC, and Sierra into post meta fields so I can filter using the taxonomies while more easily displaying the data using post meta. Here’s the class that does it: [https://github.com/fridaysystems/inventory-presser/blob/master/includes/class-taxonomy-overlapper.php](https://github.com/fridaysystems/inventory-presser/blob/master/includes/class-taxonomy-overlapper.php)

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer