我遇到类别问题,我的"产品"类别有效,但我的"帖子"类别不适用于我的产品。
add_action( 'init', 'cptui_register_my_cpts' );
function cptui_register_my_cpts() {
$labels = array(
"name" => __( 'product', 'mh-magazine-lite' ),
"singular_name" => __( 'product', 'mh-magazine-lite' ),
);
$args = array(
"label" => __( 'product', 'mh-magazine-lite' ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => false,
"rest_base" => "",
"has_archive" => false,
"show_in_menu" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => array( "slug" => "product", "with_front" => true ),
"query_var" => true,
"supports" => false,
"taxonomies" => array( "category", "post_tag", "product_cat", "product_tag", "product_shipping_class", "pa_shirt-sizes" ),
);
register_post_type( "product", $args );
// End of cptui_register_my_cpts()
}
Dunno,如果这是可能的,想要任何解决方案