我有一个自定义的帖子类型,叫做Group
为此,我已将所有必需的功能分配给管理员。然而,我仍然无法看到Status
编辑屏幕上的(post状态)下拉列表。
管理功能
$admin->add_cap("delete_others_{$group_cap}s");
$admin->add_cap("delete_{$group_cap}");
$admin->add_cap("delete_{$group_cap}s");
$admin->add_cap("delete_private_{$group_cap}s");
$admin->add_cap("delete_published_{$group_cap}s");
$admin->add_cap("edit_others_{$group_cap}s");
$admin->add_cap("edit_{$group_cap}");
$admin->add_cap("edit_{$group_cap}s");
$admin->add_cap("edit_private_{$group_cap}s");
$admin->add_cap("edit_published_{$group_cap}s");
$admin->add_cap("publish_{$group_cap}s");
$admin->add_cap("read_{$group_cap}");
$admin->add_cap("read_private_{$group_cap}s");
寄存器柱
public static function register_group_type()
{
$cap_type = self::$cpt_group;
$plural = \'Groups\';
$single = \'Group\';
$labels = [
\'add_new\' => esc_html__("Add New {$single}", \'group-shop\'),
\'add_new_item\' => esc_html__("Add New {$single}", \'group-shop\'),
\'all_items\' => esc_html__($plural, \'group-shop\'),
\'edit_item\' => esc_html__("Edit {$single}", \'group-shop\'),
\'menu_name\' => esc_html__($plural, \'group-shop\'),
\'name\' => esc_html__($plural, \'group-shop\'),
\'name_admin_bar\' => esc_html__($single, \'group-shop\'),
\'new_item\' => esc_html__("New {$single}", \'group-shop\'),
\'not_found\' => esc_html__("No {$plural} Found", \'group-shop\'),
\'not_found_in_trash\' => esc_html__("No {$plural} Found in Trash", \'group-shop\'),
\'parent_item_colon\' => esc_html__("Parent {$plural} :", \'group-shop\'),
\'search_items\' => esc_html__("Search {$plural}", \'group-shop\'),
\'singular_name\' => esc_html__($single, \'group-shop\'),
\'view_item\' => esc_html__("View {$single}", \'group-shop\'),
];
$labels = apply_filters(\'group_shop_group_labels\', $labels);
$capabilities = [
\'delete_others_posts\' => "delete_others_{$cap_type}s",
\'delete_post\' => "delete_{$cap_type}",
\'delete_posts\' => "delete_{$cap_type}s",
\'delete_private_posts\' => "delete_private_{$cap_type}s",
\'delete_published_posts\' => "delete_published_{$cap_type}s",
\'edit_others_posts\' => "edit_others_{$cap_type}s",
\'edit_post\' => "edit_{$cap_type}",
\'edit_posts\' => "edit_{$cap_type}s",
\'edit_private_posts\' => "edit_private_{$cap_type}s",
\'edit_published_posts\' => "edit_published_{$cap_type}s",
\'publish_posts\' => "publish_{$cap_type}s",
\'read_post\' => "read_{$cap_type}",
\'read_private_posts\' => "read_private_{$cap_type}s",
];
$capabilities = apply_filters(\'group_shop_group_capabilities\', $capabilities);
$rules = [
\'ep_mask\' => EP_PERMALINK,
\'feeds\' => FALSE,
\'pages\' => TRUE,
\'slug\' => esc_html__(strtolower($plural), \'group-shop\'),
\'with_front\' => FALSE,
];
$rules = apply_filters(\'group_shop_product_rules\', $rules);
$args = [
\'labels\' => $labels,
\'description\' => __(\'Groups for the team\', \'group-shop\'),
\'public\' => TRUE,
\'publicly_queryable\' => TRUE,
\'show_ui\' => TRUE,
\'show_in_menu\' => TRUE,
\'show_in_nav_menu\' => TRUE,
\'show_in_rest\' => TRUE,
\'query_var\' => TRUE,
\'rewrite\' => $rules,
\'capability_type\' => [$cap_type, $cap_type . \'s\'],
\'capabilities\' => $capabilities,
\'has_archive\' => TRUE,
\'hierarchical\' => FALSE,
\'map_meta_cap\' => TRUE,
\'menu_icon\' => \'dashicons-cart\',
\'menu_position\' => NULL,
\'show_in_admin_bar\' => TRUE,
\'supports\' => [\'title\', \'editor\', \'author\', \'thumbnail\'],
];
$args = apply_filters(\'group_shop_product_register\', $args);
register_post_type(strtolower(self::$cpt_group), $args);
}
图像参考-屏幕截图