custom taxonomy count always zero
-
I regiested post_type and taxonomy using below code :
public function cptui_register_my_cpts_site() { /** * Post Type: 网站优化信息. */ $labels = [ "name" => __("网站优化信息", 'joa'), "add_new" => __("新增网站优化信息", 'joa'), "singular_name" => __("网站优化信息", 'joa'), "add_new_item" => __("新增网站信息", 'joa'), "edit_item" => __("编辑网站信息", 'joa'), "new_item" => __("新增网站信息", 'joa'), "view_item" => __("查看网站信息", 'joa'), "view_items" => __("查看网站信息", 'joa'), ]; $args = [ "label" => __("网站优化信息", 'joa'), "labels" => $labels, "description" => "", "public" => false, "publicly_queryable" => false, "show_ui" => true, "show_in_rest" => false, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "has_archive" => false, "show_in_menu" => true, "show_in_nav_menus" => true, "delete_with_user" => false, "exclude_from_search" => true, 'capabilities' => $this->capabilities, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "rewrite" => ["slug" => "site", "with_front" => false], "query_var" => true, "menu_icon" => "dashicons-admin-site", "supports" => ["title"], "show_in_graphql" => false, ]; register_post_type("site", $args); } public function cptui_register_my_taxes_in_charge() { /** * Taxonomy: 关键词. */ $labels = [ "name" => __("负责人", 'joa'), "add_new" => __("新增责任人", 'joa'), "singular_name" => __("负责人", 'joa'), "add_new_item" => __("新增负责人", 'joa'), "edit_item" => __("编辑负责人", 'joa'), "new_item" => __("新增负责人", 'joa'), "view_item" => __("查看负责人", 'joa'), "view_items" => __("查看负责人", 'joa'), ]; $args = array( "label" => __('负责人', 'joa'), "labels" => $labels, "public" => false, "hierarchical" => true, "show_ui" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "query_var" => true, // "rewrite" => array('slug' => 'in_charge', 'with_front' => false,), "show_admin_column" => true, "show_in_rest" => false, "rest_base" => "", "show_in_quick_edit" => true, ); register_taxonomy("in_charge", ['post','site'], $args);//////////////// }
register_taxonomy(“in_charge”, [‘post’,’site’], $args);
if i use register_taxonomy only in site object type , the in_charge taxonomy count value not increace , always is zero.
if i add post , the count value will auto updated .
Is this is a bug here ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘custom taxonomy count always zero’ is closed to new replies.