I’ve created two taxonomies:
- Make
- Model
This is for a CPT Vehicles. It goes without saying, Make would be your make (Honda / Toyota / Ford / etc) and then one would select the Model based on the Make.
How do I setup the relationship between Make and Model? Or have I gone about this all wrong and it should in fact be a single taxonomy ‘Make & Model’?
Im not looking for:
Vehicle CPT
|-> Make
|-> Model
Im looking for:
Vehicle CPT
|-> Make
|--> Model
2 Answers
Taxonomies are not child of each other unlike terms, which can be. Take a look at this flowchart:
Model is a child of Make, and should not be registered as a new taxonomy. What you are trying to do, is something like setting Ford as a child of Honda, which is not right. Instead, register 1 single Make taxonomy, and then create sub-taxonomies, just like what we do in categories.
Take a look at register_taxonomy()
function at the codex, and register your taxonomy as hierarchical, then create sub taxonomies as model.