Skip to content

Instantly share code, notes, and snippets.

@maor
Last active December 12, 2015 04:29
Show Gist options
  • Save maor/4714851 to your computer and use it in GitHub Desktop.
Save maor/4714851 to your computer and use it in GitHub Desktop.
<?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