Site logo

Archived topic

Ordering hierarchial taxonomy terms

5 replies · Started by gpstart on December 5, 2022

Viewing posts 1–6 of 6

I created a taxonomy called Location that I classified as hierarchial and assigned to my Brand CPT.

Then, I created a location of Los Angeles. It's parent is California, and it's parent is USA.

When I inserted this term into my post, it displayed it in alphabetical order: California, Los Angeles, USA.

Is there a way to get it to display according to it's hierarchy? So that it displays as Los Angeles, California, USA.

I did set the hierarchy that way. That is from parent to child: USA > California > Los Angeles

Thanks.

I can provide access.

But, I've made this CPT for members only, so I'd have to create a login.

I've taken 3 screenshots that maybe will help you. If not, just let me know and I'll create a login for you and send you a link.

This first image shows that I created an hierachial structure USA > California > Los Angeles (parent to child)
https://drops.cyberfilebox.com/4gu4xl0o

Second image shows that I inserted the Location taxonomy in the post.
https://drops.cyberfilebox.com/nOu1mvzx

Third image shows the output:
https://drops.cyberfilebox.com/Jruy7xjQ

Hello there,

You'll need custom code to output and order your custom taxonomy term hierarchically.

For instance, see this article: https://cambodesign.com/wordpress-how-to-get-taxonomy-hierarchy-on-a-single-post/

Moreover, this article only shows how to retrieve custom taxonomy terms hierarchically if it's just - parent & child relationship.

An alternative would be to create custom terms, eg. Location_state, location_city...

Through this, you'll be able to retrieve and order them one by one.

It may be good to ask our Facebook group for suggestions as well: https://www.facebook.com/groups/1113359788719597

Thanks for the reference to the article. I need to read that again.

Could I request that this be added as a feature update in a newer version? I can't possibly be the only person that would want this.

This archived topic is closed to new replies.