3

This may be really obvious, but I can't find other documentation or questions about it.

Scenario

I have a directory of Businesses (custom post types). Each Business has a "Type" (custom taxonomy). The Business Types are hierarchical, such as Eat > Restaurant > African, Play > Parks, Services > Medical > Dental, etc.

Other Notes:

  • My "Type" archives should work with the core implementation and no modifications (e.g. the Restaurant archive should show all posts in that term or any child term).
  • I expect I'll be using get_terms() quite a bit in my templates.
  • I expect I'll need the additional templates provided by the Category Template Hierarchy if it supports custom taxonomies.
  • I may need to use the term descriptions from the parent at times.
  • I may integrate the Taxonomy Images plugin and possibly need the parent term's image.

Question

When entering each business, should all parent and child terms be selected or should I only select the "deepest" term (i.e. Should I assign it to "Eat," "Restaurants," and "African" or just "African?")? Is the "correct" answer in my case the "correct" way of using hierarchical taxonomies or does the "correct" answer depend on the use case?

1 Answer 1

1

Use the deepest term only. If you want to rearrange the term relations later you don’t have to go through all posts to fix the post-term relations. Plus, you are more flexible when you want to separate the posts with child terms from post associated with the current term only.

3
  • That makes sense. Are there any downsides to NOT marking the parent?
    – mrwweb
    May 31, 2012 at 23:43
  • I’m not aware of any downsides. Let’s wait wait others have to say. :)
    – fuxia
    May 31, 2012 at 23:46
  • I wish I'd get another opinion or two on this one, but this answer has served me well so far. The only downside has been that parent terms aren't reflected in the tag cloud unless they're explicitly set.
    – mrwweb
    Jul 7, 2012 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.