How do I get the top-level terms in a custom taxonomy?

I have a custom hierarchical taxonomy setup for a conference website. The top-level terms in this taxonomy are Dates, which have child terms representing session slots on that date. I’m trying to figure out how to get a list of the top-level terms within the taxonomy, that is I only want the terms that are Dates, not the terms that are sessions. Is this possible using get_terms()?

2 s
2

Try to pass 0 for parent argument in get_terms().

parent (integer) Get direct children
of this term (only terms who’s
explicit parent is this value). If 0
is passed, only top-level terms are
returned. Default is an empty string.

Leave a Comment