wp_get_object_terms – How can I order the resulting array by hierarchy?

Just a rough sketch to get your idea:

  • countries (hierarchical taxonomy)
    • France (country – sub taxonomy)
      • Champagne (state – sub sub taxonomy)
        • Le Mans (city – term)
        • Angers (city – term)
        • Nantes (city – term)

And you want to order:

$query_results = query( 'country' => 'france', 'orderby' => 'state city', 'order' => 'ASC' );

Did i get this right? If not, feel free to edit my answer or update your Q.

Leave a Comment