Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Imagine this: I have a custom post type called 'Animals' and I have registered a taxonomy for this post type called 'Types of Animal'. 'Types of Animal' would be 'dog', 'cat' and 'mouse' and so on. So that's straightforward.

But say I want to introduce child taxonomies based on the value of the Types of Animal taxonomy. I can use the fact that the taxonomy is hierarchical but if Types of Animal contained 100 terms with 50 possible sub-terms, that makes for a big mess when I'm editing.

So what I'd like to do is display a child taxonomy, say 'Breeds', when the editor selects 'dog' in the 'Types of Animal' taxonomy.

I could use tags but I'm afraid of the margin of error inputting tags. I would rather that editors had to check a box.

Is it possible to display a child/secondary taxonomy dynamically in this way?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Have a look at this tutorial for a possible solution: How To Show/Hide WordPress Meta Boxes By Selecting Categories.

Basically, all of the taxonomies would be hidden via javascript, and a function attached to the click event of the Animals taxonomy, which inspects the selected item's ID to show a corresponding child taxonomy. You'd also have to have a bit of logic on page load to show the taxonomies with terms that are already selected.

There are potential problems though - what happens if someone deselects "dog", but not any child terms?

share|improve this answer
    
Milo, that's very helpful. Thanks. –  g01010 Jun 24 '11 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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