• Hi everyone.

    I have the following post types:
    – cars
    – caravans
    – motorhomes
    – generators
    – boats
    – etc

    I also have a brands taxonomy that list the brand names of each of the above (cars, boats, caravans, etc). I noticed that with a a few of the brands, they have for example cards, boats, generators, etc. and this becomes an issue when I want list related post types under, e.g Honda ( I get generators, boats and cars).

    Another issue is since the “Brands” taxonomy is shared across the post types, I also end up getting boat brands when adding cars.

    I don’t want to have to register the same taxonomy for each of the post types. It’s too much work.

    Question 1
    Is it possible to have one taxonomy shared across multiple post types but only display taxonomy that were added under the specific post type?

    Question 2
    Can I register the taxonomy once to accomplish what I want to accomplish?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Taxonomy terms cannot easily be related to only one of several post types the taxonomy is used for. Terms can have meta data assigned, so in theory something might be possible, but the fact it’s difficult likely means your desired organizational schema is flawed.

    Taxonomies need to be related to each post type in turn, there’s no global taxonomy that relates to any post type. That said, you could have custom code that gets all post types and loops through them all, relating the taxonomy to each in turn.

    Needing to have a lot of post types also indicates your schema may be flawed. For example, there are lots of online stores with hundreds of different, disparate products, yet they are all of only one post type. All of those items you have as types could have been a taxonomy itself for a single post type. If it were a hierarchical taxonomy, you could assign child terms under each which only relates to the parent, so car/Honda would be distinct from generator/Honda. Or manage the current post types and brands as two separate taxonomies for one post type.

Viewing 1 replies (of 1 total)
  • The topic ‘Same taxonomy but not shared between post types’ is closed to new replies.