I have a view of terms where I show in a grid terms form the highest level (those with parent = 0). I have to limit this view to only show those terms that contain at least one child term. I can't figure out how to do this. Anyone? Thanks!

  • The Drupal API has a function taxonomy_get_children which can be used to verify the existence of children on a term. api.drupal.org/api/drupal/modules!taxonomy!taxonomy.module/…
    – Ashlar
    Commented Mar 13, 2012 at 14:44
  • I know about the function but I would like to do it with out any programming. If it is possible. Commented Mar 13, 2012 at 16:49
  • I have been looking for several months and have never come across a way in Drupal to do so through the UI or a contributed module. Drupal menu and taxonomies store parent relationships in the database, but not children, so the only option is to run a query such as in this function.
    – Ashlar
    Commented Mar 13, 2012 at 17:22

3 Answers 3


I would do quite as Arthur did, but I don't think double relationship is necessary :

  1. Set a relationship "parent term"
  2. Make it mandatory
  3. Display "term" with the relationship

You then will have only parent terms with children displaying.

Of course, you'll then have to aggregate or group to avoid duplications of parents with multiple children.


I would say trying to do it via Views UI would be bending views too much. How about putting together the query yourself and then using views for rendering. As described in this Drupal post - http://drupal.org/node/409808

And here is another article that talks about "programming" views - http://www.metaltoad.com/blog/views-3-makes-programmers-happy

Does that help?

  • Actually, I fully understand the original poster, who apparently want to push admin UI to its limits and expects from Views kind of a filter to show only parents that have children. Myself I had the same challenge, but could do that the raw PHP way, which is not an option for everyone. Commented Jun 12, 2012 at 13:43

How about reversing the approach: rather than selecting parents with children, select children but display their parents. You'd need to establish a double relation for that. First, you need to look for the parent and make it required, and then - from the parent - establish a parent-of-parent relation - and that ancestor should be null (if what you meant was the topmost level).

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.