I have WordPress taxonomy custom registered and in Admin panel its terms are being shown in Alphabetic order. I want to change it in custom order as in order they were added. So in Dashboard and Add New Post and Edit Post screen, the taxonomy widget should show terms in the order I select and not just alphabatically.
I see there is a plugin for this, however i wanted to accomplish this using custom code.
I have tried the parameter “sort” from this page: register_taxonomy codex. But still no success so far.
Following is my code:
add_action( 'init', 'register_taxonomy_page_assignments' );
function register_taxonomy_page_assignments() {
$labels = array(
'name' => _x( 'Page Assignments', 'passign' ),
'singular_name' => _x( 'Page Assignment', 'passign' )
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => true,
'show_admin_column' => true,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'page','with_front' => false),
'query_var' => true
);
register_taxonomy( 'passign', array('post','ad_listing'), $args );
}
Try register_taxonomy codex Reserverd Terms Section
orderby
as argument.It may help youCredit goes to this visit this, It may help you get some idea.