1

everyone, is there way to order categories in add/edit post in admin dashboard. The problem is my order must be custom, not by Name or ID. For example:

  • Rumors (id 5)

  • News (id 1)

  • Features (id 7)

  • etc.

    The ideal solution will be to order categories by description. That way in category description field I will put number or letter and categories will order right.

Thank you in advance!

1 Answer 1

2

Use the get_terms_args hook and modify the orderby argument, like so:

add_filter( 'get_terms_args', 'my_sort_terms', 10, 2 );
function my_sort_terms( $args, $taxonomies ) {

    $args['orderby'] = 'description';

    return $args;
}

Possible values for this argument are listed in the codex.

1
  • Thank you for the fast comment. With your code and little edits, now it check the description of the categories and order them like I want. Commented Feb 27, 2013 at 15:33

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.