• Resolved Bradford

    (@b3nelly)


    When using the get_terms function, I’m unable to sort the results. The results are always ordered by the ID. I know the default orderby is by name, so my best guess at this point is a plugin is adding a filter or something. It’s not the theme, as my team and I created it.

    I’ve tried the following:

    $organizations = get_terms('organizations','hide_empty=0&orderby=name&order=ASC');
    
    $organizations = get_terms('organizations',array('hide_empty'=> 0, 'orderby'=>'slug','order'=>'ASC'));

    I did trying this with the category taxonomy and it still didn’t work.

    Reference page: https://codex.www.ads-software.com/Function_Reference/get_terms

    Any help would be greatly appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter Bradford

    (@b3nelly)

    I found the cause of the problem. One of the site admins installed a plugin called “Category Order and Taxonomy Terms Order” that I was unaware of and it was overriding the get_terms function.

Viewing 1 replies (of 1 total)
  • The topic ‘get_terms orderby not working (not sorting)’ is closed to new replies.