我有个树桩。。。我创建了一个新的分类法,称为Article Type。我为它创建了四个值,如此元框所示:
当我选择“娱乐”术语并更新帖子时,奇怪的事情发生了:系统使用表wp\\U terms中娱乐的term\\u id创建了一个新术语,请参见下面的pix:
这显然不是想要的效果,我只是想选择“娱乐”。
我不知道从哪里开始挖掘这个。。。谁能告诉我为什么会这样?
如果有必要,下面是用于创建分类的代码:
function hhl_article_type() {
$labels = array(
\'name\' => _x( \'Types\', \'Taxonomy General Name\', \'hhl\' ),
\'singular_name\' => _x( \'Type\', \'Taxonomy Singular Name\', \'hhl\' ),
\'menu_name\' => __( \'Article types\', \'hhl\' ),
\'all_items\' => __( \'All Items\', \'hhl\' ),
\'parent_item\' => __( \'Parent Item\', \'hhl\' ),
\'parent_item_colon\' => __( \'Parent Item:\', \'hhl\' ),
\'new_item_name\' => __( \'New Item Name\', \'hhl\' ),
\'add_new_item\' => __( \'Add New Item\', \'hhl\' ),
\'edit_item\' => __( \'Edit Item\', \'hhl\' ),
\'update_item\' => __( \'Update Item\', \'hhl\' ),
\'view_item\' => __( \'View Item\', \'hhl\' ),
\'separate_items_with_commas\' => __( \'Separate items with commas\', \'hhl\' ),
\'add_or_remove_items\' => __( \'Add or remove items\', \'hhl\' ),
\'choose_from_most_used\' => __( \'Choose from the most used\', \'hhl\' ),
\'popular_items\' => __( \'Popular Items\', \'hhl\' ),
\'search_items\' => __( \'Search Items\', \'hhl\' ),
\'not_found\' => __( \'Not Found\', \'hhl\' ),
\'no_terms\' => __( \'No items\', \'hhl\' ),
\'items_list\' => __( \'Items list\', \'hhl\' ),
\'items_list_navigation\' => __( \'Items list navigation\', \'hhl\' ),
);
$rewrite = array(
\'slug\' => \'type\',
\'with_front\' => true,
\'hierarchical\' => false,
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_admin_column\' => true,
\'show_in_nav_menus\' => true,
\'show_tagcloud\' => false,
\'rewrite\' => $rewrite,
\'show_in_rest\' => false,
\'meta_box_cb\' => \'post_categories_meta_box\',
);
register_taxonomy( \'article_type\', array( \'post\' ), $args );
}
add_action( \'init\', \'hhl_article_type\', 0 );