Last active
December 12, 2015 04:29
-
-
Save maor/4714851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function maor_reorder_categories_postbox( $args, $taxonomies ) { | |
global $pagenow; | |
$ok_pages = array( 'post-new.php', 'post.php' ); | |
if ( ! in_array( $pagenow, $ok_pages ) || ! in_array( 'category', $taxonomies ) ) | |
return $args; | |
/** | |
* http://codex.wordpress.org/Function_Reference/get_terms#Possible_Arguments | |
*/ | |
$desiered_new_order = 'id'; | |
return array_merge( $args, array( | |
'orderby' => $desiered_new_order, | |
'order' => 'DESC', | |
) ); | |
} | |
add_filter( 'get_terms_args', 'maor_reorder_categories_postbox', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment