i have a vocabulary that contain plus of 5 level descendant, i need to create the view to display the first 2 levels and grouping by the first one, i do this:

  1. FIELDS: (Parent) Taxonomy term: Name - Taxonomy term: Name
  2. FILTER CRITERIA: Taxonomy vocabulary: Machine name (= All Type Announce)
  3. SORT CRITERIA: (Parent) Taxonomy term: Weight (asc)
  4. RELATIONSHIPS: Taxonomy term: Parent term

and i get all list of taxonomy for this vocabulary grouping by parents, how to set only 2 levels?


This link saved me :), hopefully you get the results too....

Here is a quick tip that has proved helpful in a few different instances. Say you have a taxonomy vocabulary that has a set of root terms and these terms have children. For example:

Honda -Civic -Accord Toyota -Camry -Prius

Now say you want to configure a view that only shows the first level of this vocabulary. For example:

Honda Toyota

This is pretty easy to do and can prove useful when wanting to show a top level view of your terms. You can accomplish this with two steps within a term view:

  1. Add a relationship to the ‘Parent Term’.
  2. Add a filter using the ‘Parent Term’ relationship against the Term Name and set the operator to ‘Is Empty (NULL)’

Simple as that.

Happy Drupaling!

  • Which doesn't answer the question at all... + the link is outdated. – MrUpsidown Aug 17 '19 at 11:37

It's simple. In fact, there is no need to add any relationship in the Views. Just create the taxonomy term view and add a filter criteria of Taxonomy term: Parent term. (see screenshot) Then set the value to be equal to ''. This will fetch you all the parent terms as they don't have any parent! ('') See the last link

  • Thank you for your answer. I think that this would really help. It would help to be more descriptive with answers rather than pasting a screenshot because images are not accessible for everyone. A detailed list of steps would help compliment your answers in the future. – mradcliffe Nov 12 '19 at 14:39

You should be just fine by introducing 2 chained parent relationships. Setting the criterion where parent of the parent is NULL should work. Well, this is a purely UI way of doing that, which is a pro. The con is that queries with nested relations might become heavy at some point, therefore consider turning on Views cache when you deploy the site.

  • "Artur's" method is pretty good. The only thig what I want to say is that "Setting the criterion where parent of the parent is NULL" need to be "equal to 0 (zero)". Also to get it work I had to group terms by parent. – hugronaphor Jun 24 '13 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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