我认为最好注册自定义分类法类型,否则您可以add categories to your CPT code which registers your CPT.
add_action( \'init\', \'wpsites_register_taxonomy_types\' );
function wpsites_register_taxonomy_types() {
register_taxonomy( \'cpt-type\', \'cpt\',
array(
\'labels\' => array(
\'name\' => _x( \'Types\', \'taxonomy general name\', \'theme\' ),
\'add_new_item\' => __( \'Add New CPT Type\', \'theme\' ),
\'new_item_name\' => __( \'New CPT Type\', \'theme\' ),
),
\'exclude_from_search\' => true,
\'has_archive\' => true,
\'hierarchical\' => true,
\'rewrite\' => array( \'slug\' => \'cpt-type\', \'with_front\' => false ),
\'show_ui\' => true,
\'show_tagcloud\' => false,
));
}