I am looking for a way to display both the Child and Grand Children of a taxonomy term (found on the URL) on the same page.

Example Taxonomy called Food. Top root term called GRAPE has children and grandchildren like this.






-- White

How can we create a view (block in our case) that will always show the children and grandchildren of the parent term from URL?

I am guessing one or two contextual filter where the filter takes the taxonomy term ID Raw from the URL.

Example: doamin.com/fruit/grape/,

therefore, parent will be second in path. The parent term in this case is Grape.

So in the block we will show children and grandchildren of Grape:





-- White

Ideally grouped by RED, WHITE.

Apply the contextual filter to a second filter? Not sure, I am just guessing.

  • 1
    You can create a Taxonomy term Views, limit to the Vocabulary and it will list all the terms, no matter the depth. Is this what you're after? If it's to be limited by one term, then use the Relationship Parent and use Contextual filter Parent term to filter. You'll probably need two relationships and filters for the two levels.
    – prkos
    Sep 8, 2018 at 1:04
  • I will give it a try and let you know.
    – Progonat
    Sep 8, 2018 at 11:12
  • Just had a chance to mess with this. So it is close but not exactly. The parent term will is on the UR, in this case GRAPE. I can add a contextual filter for that. But how can I narrow this down to show all the children and grand children of the GRAPE? So Red, White are the children, and also their children which are Small, Medium, Large.
    – Progonat
    Sep 8, 2018 at 23:50
  • Ok so far I have been able to get the direct children of GRAPE to show on the page. But I am stuck on how do I get the grand children of grape to show up? In other words the children of the terms that are showing on the page.
    – Progonat
    Sep 9, 2018 at 0:06

1 Answer 1


You can create a Block that displays Child and Grandchild terms (in terms of hierarchy within a Taxonomy Vocabulary) on a taxonomy term pages with the use of an additional module Views Contextual Filters OR to tell the Views to show children OR grandchildren.

Contextual filters always work with the AND operator, so this module is necessary to loosen that circumstance.

  1. Create View of type Taxonomy term
  2. Filter it to show only the Food Vocabulary
  3. To show Children of a term on that term page we can use the Parent term Contextual filter with these options:
    When the filter value is NOT available
    Provide default value
    Taxonomy term ID from URL
    Load default filter from term page
    When the filter value IS available or a default is provided
    Specify validation criteria
    Taxonomy term ID

    Now if you enter a term ID into Preview you will see the Child terms of that term. This takes care of the Parent-Child.

  4. To filter Grandchildren we have to introduce that level of connections into View. Add the Parent Relationship
  5. Add another Parent Relationship and make it use the first one, this is how we get Grandparent info
  6. Add a new Contextual filter Term ID and make it use the second Parent Relationship and other options the same as above.

    Now if you enter all/[TID] you will see the grandchildren terms of the [TID].

  7. To make the Contextual work with OR go to Query settings and enable Contextual filters OR option.

    To test enter the term ID twice into Preview [TID]/[TID].

  8. Add the Field Name from the Taxonomy term Category and make it use the first Parent Relationship (that is the Parent, not the Grandparent), you can Exclude it from display later
  9. Under Format Settings set the Grouping field Nr.1 set the Parent field (you might want to use the HTML List as the Format)

The results will show the grandparent first and its children, then grandchildren under their parents.

If the grandparent showing their children is not necessary for you, which it probably isn't, because it will be implied from circumstances by being on the grandparent page, you can edit the Filter from step 2 and make it use the second Parent Relationship, this will only show Grandchildren grouped by Parents.

Place the Block in a region and limit the Pages to /taxonomy/term/*.

Alternatively you'd have to use Views Field View to insert one view into another, which can be performance heavy. I'm not sure how the above compares, it does use some LEFT JOINs too which aren't so performance friendly.


Your Answer

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

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