WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hard question to explain here. So here goes:

I have a chapter/section scenario I'm trying to work out. The custom post type of "Books" has two custom taxonomies, "Chapters" and "Sections". The Chapters, are sort of like the higher level taxonomy with Sections being inside each chapter. So it would look something like this:

  • Chapter 1

    • Section 1.1
    • Section 1.2
    • Section 1.3
    • Section 1.4
  • Chapter 2

    • Section 1.1
    • Section 1.2

Basically, I'm trying to list out the sections, relative to the specific Chapter on a Chapter taxonomy page. I'm using get_terms() to grab the list of section taxonomies. The problem is, when I use get_terms() it lists out every section in all Chapters. So for instance, Chapter 2 only has posts with Sections 1.1 and 1.2 selected. But using get_terms() lists out Sections 1.3 and 1.4 as well for that Chapter.

I need a way to isolate the sections taxonomy list to only those taxonomies which are selected in conjunction with the selected Chapter taxonomy.

In a way, it's sort of like this question here

share|improve this question
up vote 2 down vote accepted

It would make more sense for the sections to be child terms below each chapter. See my answer to the similar question you referenced as well as MikeSchinkel's explanation of hierarchical taxonomies.

Using the the term_id returned from get_terms use get_term_children to get the sections associated with each chapter.

share|improve this answer

Your Answer


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.