Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@asadowski10
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asadowski10/c7bb4fd70a1924e95936 to your computer and use it in GitHub Desktop.
Save asadowski10/c7bb4fd70a1924e95936 to your computer and use it in GitHub Desktop.
Change taxonomy order in admin metabox by name
<?php
/*
Plugin Name: Metaboxes taxonomy order
Description: Change taxonomy order in admin metabox by name
Plugin URI: http://www.beapi.fr
Version: 1.0
Author: BeAPI
Author URI: http://www.beapi.fr
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
add_action( 'admin_init', 'as_check_admin_page' );
function as_check_admin_page(){
global $pagenow;
if( !in_array($pagenow, array( 'post.php', 'post-new.php' ) ) ){
return false;
}
add_filter( 'get_terms_orderby', 'as_meta_boxes_terms_order', 15, 3 );
}
function as_meta_boxes_terms_order( $orderby, $args, $taxonomies ) {
return 't.name';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment