Development

Get a List of Top-level Taxonomy Terms

Quick Tip: Getting a list of taxonomy terms is easy using a view (type: Taxonomy). Trying to get only terms at the highest level is a bit trickier. One method I came up with is to add a Taxonomy: Parent term argument on the view. The key is to tell the argument to Provide default argument of PHP Code and set the value to  return 0;

The result is that only top-level terms (terms without parents) are returned.

Leave a Reply

Your email address will not be published.