0

I need to get all the slugs/terms - those that are used & those that are not. It's hierarchical (3-4 levels).

How to get all (used & not used) terms/slugs in hierarchical order?

This code returns 1. level slugs & ONLY other levels that ARE USED:

 $locations = get_terms('location', array( 'orderby' => 'slug', 'parent' => 0, 'hide_empty' => false) ); 

This code returns a mess - hierarchy is all off & it's a big mess:

 $locations = get_terms('location', array( 'orderby' => 'slug', 'hide_empty' => false) ); 
0

Try this.

$locations = get_terms( 'location', 'hide_empty=0&orderby=term_group' );

The codex says to avoid using term_group but it should be fine. It was never fully implementet but, according to others, its used quite often.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.