Here are my settings in CPT UI for the post type and taxonomy if that is to any help.
function cptui_register_my_cpts_datacenter_news() {
/**
* Post Type: Data Center News.
*/
$labels = array(
"name" => __( "Data Center News", "custom-post-type-ui" ),
"singular_name" => __( "Data Center News", "custom-post-type-ui" ),
);
$args = array(
"label" => __( "Data Center News", "custom-post-type-ui" ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => array( "slug" => "datacenter_news", "with_front" => false ),
"query_var" => true,
"supports" => array( "title", "editor", "thumbnail" ),
"taxonomies" => array( "news_tag", "dc_news_tax" ),
);
register_post_type( "datacenter_news", $args );
}
add_action( 'init', 'cptui_register_my_cpts_datacenter_news' );
function cptui_register_my_taxes_dc_news_tax() {
/**
* Taxonomy: News Category.
*/
$labels = array(
"name" => __( "News Category", "custom-post-type-ui" ),
"singular_name" => __( "News Category", "custom-post-type-ui" ),
);
$args = array(
"label" => __( "News Category", "custom-post-type-ui" ),
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"hierarchical" => true,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => array( 'slug' => 'dc_news_tax', 'with_front' => true, 'hierarchical' => true, ),
"show_admin_column" => false,
"show_in_rest" => true,
"rest_base" => "dc_news_tax",
"rest_controller_class" => "WP_REST_Terms_Controller",
"show_in_quick_edit" => false,
);
register_taxonomy( "dc_news_tax", array( "datacenter_news" ), $args );
}
add_action( 'init', 'cptui_register_my_taxes_dc_news_tax' );