Posts are things
Taxonomies and terms are types or classifications of things
E.g. I could have a post type animal
, with animals such as “Betsy”, “Rover”, and “Mittens”. I can then have a taxonomy called species
, that contains terms such as cat
, dog
, budgie
. I can then assign the “Mittens” post to the cat
term in the species
taxonomy.
The important part here is that all the content is inside posts. Taxonomies and terms provide means to group or classify the content, but they aren’t content themselves
A good heuristic is that you filter and group posts using taxonomies. In this case Menus sounds like a taxonomy, and breakfast/lunch/dinner/etc sound like terms in that taxonomy. The same for categories. Finally, a post of type dish
Interesting Facts
- Categorys are a taxonomy, individual categories are terms in the
category
taxonomy - Tags are also a taxonomy, the difference being that they are of the taxonomy
tag
and that thetag
taxonomy is non-hierarchical ( no parent or child tags ) - Some taxonomies do not have a UI and are hidden from the user
- Nav menus are actually terms. The menu items are posts of type
nav_menu
, and they’d held together by a shared taxonomy term. Creating a new menu creates a new term. This is all done behind the scenes - Taxonomies have their own archive pages and templates, refer to the template hierarchy flow chart to see what templates are available to you
- Taxonomy relationships appear to be between terms and posts, but they’re actually between terms and IDs. These don’t have to be post IDs, they can be user IDs too. There are articles about creating user taxonomies for things such as jobs and departments etc
- I would recommend that you use the taxonomy and term APIs exclusively, and ignore the tag and category specific APIs. The category/tag functions use them internally, so it should simplify your work as the same code can be used for all taxonomies, and you’ll have a better understanding of how things work