Forums

Return taxonomy terms in hierarchical order (1 post)

  1. jlheidecker
    Member
    Posted 4 months ago #

    I have a "location" custom taxonomy that is hierarchical in nature and has states with children cities. When I use get_the_terms for a particular post, the returned array always returns the city and state in alphabetical order. meaning array[0] could sometimes be the city or state. this is an issue when trying to display "city, state" and the state appears before the city in the alphabet: "alaska, anchorage" is not the intended result.

    Anyway to retrieve a the custom taxonomy and preserve the hierarchy? i.e. the array returned has array[0] as the most immediate term/category, and array[1] has its parent, and so on... or the reverse order is ok too.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.