WP API post categories are not in hierarchical order

admin

Administrator
Staff member
I'm using WP-API to develop an app while using wordpress as its CMS. My problem is when I want to show the categories hierarchy in the post.

I realise that wordpress arranged categories in alphabetical order, so this messed up the breadcrumb.

what I want:

ParentCat > ChildCat > GranchildCat

What I got instead:

ChildCat > GrandchildCat > ParentCat

How can I make WP-API to arrange the categories ID in hierarchical order? I never touch any wordpress programming, but I'll be glad if to learn it if it can solve my problem.

Thank you very much