Home Forums General Issues Books & authors – bidirectional relationship or custom taxonomy?


Books & authors – bidirectional relationship or custom taxonomy?

  • Hi,

    I have a conceptual question. Think about the example books and authors. I made a webshop that sells books. BOOKS (WooCommerce products) have different attributes for description and filtering.

    They also have a bidirectional relationship with AUTHORS. So there is also the CPT author, that also comes with some fields and images to describe them.

    Now, I realize I could also create a custom taxonomy for the WooCommerce product (book). I was not aware that I can add custom fields to a custom taxonomy, i.e. it will server like a category but at the same time describe the category in more detail with custom fields.

    I am asking myself now: would it be better to assign the custom taxonomy to the books, instead of creating a separate CPT author and bidirectional relationship?

    (actually, it’s composers and musical pieces but easier to comprehend with books and authors)

    best regards

  • I don’t see any difference one way or the other except for one thing.

    Lets say that in the future you wanted to group the authors by genre, Sci-Fi, Historical, Non Fiction, etc. It would be pretty much impossible to do this with authors being a taxonomy. On the other hand as a CPT you could add a genre taxonomy attached to the author as well as the books so that both authors and books could be sorted into these terms.

    As far as future proofing it I would go with a CPT.

  • Thanks a lot John! This kind of input is so much of value, as it’s important to know what to do before figuring out how to do it.

    I discussed this with someone else as well and she suggested even a complete other approach by using WooCommerce attributes instead of CPT and instead of a custom taxonomy. Many opportunities out there.

    Thanks for explaining

  • WC attributes are nothing more than a built in taxonomy system. The attributes you create for example “Author” are child taxonomies.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.