I have a custom hierarchical taxonomy named custom_taxonomy. For example:
- term 1_1
- term 1_2
- term 1_3
- term 2_1
- term 2_2
- term 2_3
I want to display them on the post page as like in example above: name of parent taxonomy and all its childs, then another parent taxonomy and all childs of this one.
Could you please advice the best way to do this.
I thought to take only parents taxonomies via
get_terms and then through the loop take childs elements by
get_term_children. Only one thing, I don't know how to display only terms related to current post in this case.