My website has two taxonomies school and city, are connected. Here's city term list

-New Rochelle(sub-term)

And school term has a city_field connected (with term referenced) to city taxonomy. I can list schools according to city terms(eg:newyork schools)

Problem: All city terms show schools. That's ok. But parent term(newyork) doesn't show subterm(Yonker, Albany, New Rochelle,Utica) schools.

Newyork (parent term) shows schools if only newyork selected. It should show other city schools under newyork.

What I did:

I've tried to add parent relationship, no result. I've tried to add parent relationship to contextual field, taxonomy term:name field and criteria and many combinations. No result...

Here's view structure: I've done with prkos help term to term relationship view . You may check here if you want to see how it'shandled.

Any help or article guide with this would be awesome . Thanks

1 Answer 1


I was able to solve it, although there may be a more elegant solution. I had to use two additional modules: Views arg parent term and Views Contextual Filters OR. There are a lot of LEFT JOINs so it's not very performance friendly.

The problem actually lies in listing the children terms (Yonkers, Albany, etc) of the term page you're currently viewing (Newyork), along with the term of the page itself (Newyork). Once you solve that it's simple to pull information about the terms from School term vocabulary that reference your City terms (through a Relationship).

List the term and its children on the term page

  1. Start with Taxonomy Term View type (Block Display), filter to list only City vocabulary. Add Fields for Term ID or Term name to display Cities just to test that all are there (you should see all Cities listed).

    You can add the relevant School terms (that reference the term listed) although it's not yet necessary, we can take care of it when we get the correct contextual filtering.

  2. Add a Contextual filter Term ID from Taxonomy term Category, and configure it 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
    Filter value type: Term ID

    You can now test this filter by entering a City term ID into the Preview field, it should limit the results list to show only that City views row. (You can see all of the results by entering all into Preview.)

  3. To list child City terms add a Relationship Parent term from Taxonomy term Category, don't require it or it will limit the results beyond what is useful to this case
  4. Add another Contextual filter Term ID from Taxonomy term Category, make it use the Parent Relationship from the previous step and configure it similarly to the last one, only change one option: filter Type:
    Taxonomy parent term ID from URL
  5. Under Views Query settings tick Contextual filters OR, best to apply it only to this Block so it doesn't interfere with your other Displays if you have them.

    This will make all Contextual filters work with an OR operator instead of AND. In your case it will allow Views to filter by term ID of the page you're viewing OR it's child, so both options will be valid.

    You can now enter a city term ID twice into Preview and you'll see both that term and its children. For example, let's say your Newyork term ID is 18, if you enter 18/18 into Preview you'll see all the terms from your City vocabulary.

    Show which terms reference the ones listed

  6. To show the School terms that reference City terms add a Relationship Taxonomy term using City. You can require it, this will exclude all City terms from the list that aren't referenced by any School terms. Since it's a School terms list we want in the end it doesn't make sense to allow any "empty" rows.

  7. Add a Field Taxonomy term: Name and make it use the Relationship from the previous step (field_city).

    You can now see the relevant School terms in your results! You can now remove the City TID and Name fields, if you don't need them for the testing, so you only end up with School terms.

  8. Place the Block on your City term pages and it will list School terms that reference that term or its children. You'll probably only want to place it on first level term pages (Newyork) because it doesn't work in reverse, it won't display parent terms when you're viewing child term pages, it will only list their own related ones.

    Add the third Taxonomy level

  9. Just in case someone needs it, if the Vocabulary has the third level, to show grandchildren on parent pages you have to add another Relationship Parent term, make it use the earlier Parent Relationship, don't require it.

  10. Add another Term ID Contextual filter and configure it like the second one, with Taxonomy **parent** term ID from URL, only make it use the second Parent Relationship.

    You'll now have to enter the parent TID thrice to make the Preview work 18/18/18. (This doesn't affect the Block, arguments are handled automatically.)


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.