get_terms() orderby name is not working - wordpress get_terms() orderby name is not working - wordpress wordpress wordpress

get_terms() orderby name is not working - wordpress


Showed up here with the same problem, and like others mentioned, the culprit was a plugin related to taxonomy sorting. Category Order and Taxonomy Terms Order, in my case. I deactivated it, and my terms list popped into order.


Your code should work fine. I had for same problem and I found a hook in my plugin that changed 'orderby' value. It might be the same case.
I suggest you look for a filter function hooked to get_terms() in your plugin/theme.

Possible hooks:

  • terms_clauses
  • get_terms_orderby
  • get_terms_args

EDIT: Before you go scanning the hooks you should try adding 'menu_order' => false to your args, it might do the job for you. There are taxonomies with manual drag&drop sorting (menu_order), so you just need to unable it.


I just tested your code on my localhost and it works.

                    'orderby'           => 'name',                     'order'             => 'ASC',                    'hide_empty'        => false,                     'fields'            => 'all',                     'parent'            => 0,                    'hierarchical'      => true,                     'child_of'          => 0,                    'childless'         => false,                    'pad_counts'        => false,                     'cache_domain'      => 'core'