简体   繁体   中英

WordPress Custom Taxonomy Terms Custom Order in Dashboard & Admin Panel

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 );
} 

尝试register_taxonomy codex Reserverd Terms Section orderby作为参数。它可以帮助你信用去这个访问这个,它可以帮助你得到一些想法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM