I’m building a <select>
dropdown to display a list of terms for a custom hierarchical taxonomy. How do I know the depth of each term? I’d like to add some indentation for child-terms (the more deeply they’re nested, the more indentation there should be).
However I’m not able to retrieve the depth level from get_terms()
. How to get the depth level as an integer?
You can use wp_dropdown_categories():