In this example, you will learn how to change the categories order in the admin dashboard in WordPress. The order may be ASC or DESC, and the orderby can be:
1. count
2. description (it should, but didn’t work so well for me, futher tests necessary)
3. name
4. slug
1 2 3 4 5 6 7 8 9 10 11 12 |
add_filter( 'get_terms_args', 'wpse_53094_sort_get_terms_args', 10, 2 ); function wpse_53094_sort_get_terms_args( $args, $taxonomies ) { global $pagenow; if( !is_admin() || ('post.php' != $pagenow && 'post-new.php' != $pagenow) ) return $args; $args['orderby'] = 'slug'; $args['order'] = 'DESC'; return $args; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.