I am working on a custom taxonomy sorting to make popular terms. The requirement is to sort by popular posts by post count and also I need to sort terms by name to get it alphabetical order.

Here is my code

$args = array(
'hide_empty' => 0 ,
'orderby' => 'count',
'orderby' => 'name',
'parent'=> $cat_main->term_id

$terms = get_terms('question_type',$args);

Another condition is that orderby count has to be DESC and orderby name has to be 'ASC'

Any suggestions?

  • Please provide an example of the expected output. Your question is a bit confusing Commented Oct 8, 2014 at 9:18

1 Answer 1


This won't be possible via the function itself or to be exact by just providing parameters/arguments. You have to do this via hooks to alter the default behavior, I think. You should take a closer look at at least two, they are: get_terms_orderby and/or terms_clauses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.