admin管理员组文章数量:1414621
I have a custom post type called Group
for that I have assigned all required capabilities to Admin. However, I am still not able to see Status
(post status) dropdown on edit screen.
Admin Capabilities
$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");
Register Post
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);
}
Image Reference - Screenshot
I have a custom post type called Group
for that I have assigned all required capabilities to Admin. However, I am still not able to see Status
(post status) dropdown on edit screen.
Admin Capabilities
$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");
Register Post
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);
}
Image Reference - Screenshot
Share Improve this question edited Sep 18, 2019 at 7:36 pixelngrain asked Sep 18, 2019 at 4:31 pixelngrainpixelngrain 1,3901 gold badge23 silver badges50 bronze badges1 Answer
Reset to default 0There isn't one.
In the classic editor the post status can be changed in the Publish box. There'll be a small Edit link next to where it says "Status: Published".
In the block editor, the post status is determined by the date and visibility set in the Status & Visibility box, under the Document Tab, and can be set to Draft by clicking Switch to Draft in the toolbar along the top.
There's no dropdown with just a list of statuses in either editor.
本文标签: capabilitiesCan39t see post status drop down for custom post type
版权声明:本文标题:capabilities - Can't see post status drop down for custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745150849a2644914.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论