不幸的是,不存在一种干净的方法来做到这一点,因为注册分类法不提供menu_order
论点
但你可以采取全球行动$submenu
变量并对其重新排序,类似于
add_action( \'admin_menu\', function() {
global $submenu;
$found = FALSE;
$before = $after = array();
$tax_slug = \'my_custom_tax\'; // change your taxonomy name here
foreach ( $submenu[\'edit.php\'] as $item ) {
if ( ! $found || $item[2] === \'edit-tags.php?taxonomy=\' . $tax_slug ) {
$before[] = $item;
} else {
$after[] = $item;
}
if( $item[2] === \'edit-tags.php?taxonomy=category\' ) $found = TRUE;
}
$submenu[\'edit.php\'] = array_values( array_merge( $before, $after ) );
}, 0 );