DELETE_PUBLISHED_POST不工作

时间:2019-01-21 作者:J.BizMai

我制作了一个插件,其中有一个自定义的post类型,称为“product”。由于某些原因,管理员无法移动到列表表中的垃圾站。

我知道这样做的能力是delete_published_posts.我在右侧页面上检查了管理员的所有功能,如下所示:

$user = wp_get_current_user();
    pretty_var_dump( $user->allcaps );

array (
    \'switch_themes\' => true,
    \'edit_themes\' => true,
    \'activate_plugins\' => true,
    \'edit_plugins\' => true,
    \'edit_users\' => true,
    \'edit_files\' => true,
    \'manage_options\' => true,
    \'moderate_comments\' => true,
    \'manage_categories\' => true,
    \'manage_links\' => true,
    \'upload_files\' => true,
    \'import\' => true,
    \'unfiltered_html\' => true,
    \'edit_posts\' => true,
    \'edit_others_posts\' => true,
    \'edit_published_posts\' => true,
    \'publish_posts\' => true,
    \'edit_pages\' => true,
    \'read\' => true,
    \'level_10\' => true,
    \'level_9\' => true,
    \'level_8\' => true,
    \'level_7\' => true,
    \'level_6\' => true,
    \'level_5\' => true,
    \'level_4\' => true,
    \'level_3\' => true,
    \'level_2\' => true,
    \'level_1\' => true,
    \'level_0\' => true,
    \'edit_others_pages\' => true,
    \'edit_published_pages\' => true,
    \'publish_pages\' => true,
    \'delete_pages\' => true,
    \'delete_others_pages\' => true,
    \'delete_published_pages\' => true,
    \'delete_posts\' => true,
    \'delete_others_posts\' => true,
    \'delete_published_posts\' => true,
    \'delete_private_posts\' => true,
    \'edit_private_posts\' => true,
    \'read_private_posts\' => true,
    \'delete_private_pages\' => true,
    \'edit_private_pages\' => true,
    \'read_private_pages\' => true,
    \'delete_users\' => true,
    \'create_users\' => true,
    \'unfiltered_upload\' => true,
    \'edit_dashboard\' => true,
    \'update_plugins\' => true,
    \'delete_plugins\' => true,
    \'install_plugins\' => true,
    \'update_themes\' => true,
    \'install_themes\' => true,
    \'update_core\' => true,
    \'list_users\' => true,
    \'remove_users\' => true,
    \'promote_users\' => true,
    \'edit_theme_options\' => true,
    \'delete_themes\' => true,
    \'export\' => true,
    \'edit_product\' => true,
    \'read_product\' => true,
    \'delete_product\' => true,
    \'edit_products\' => true,
    \'edit_others_products\' => true,
    \'publish_products\' => true,
    \'read_private_products\' => true,
    \'create_products\' => true,
    \'edit_post\' => true,
    \'delete_private_products\' => true,
    \'delete_published_products\' => true, //<-- ?!
    \'delete_others_products\' => true,
    \'edit_private_products\' => true,
    \'edit_published_products\' => true,
    \'administrator\' => true,
)
所以,我不知道为什么它不起作用。有人有主意了?

1 个回复
最合适的回答,由SO网友:J.BizMai 整理而成

我需要看到的是,这些帖子都是草稿,我必须增加能力delete_posts.

相关推荐

Custom Post Type Capabilities

我有一个自定义的帖子类型,我希望作者能够编辑其他帖子,但不能删除其他帖子。我的代码如下:$labels = array( \'name\' => __( \'Book\', \'textdomain\' ), \'singular_name\' => __( \'Book\', \'textdomain\' ), \'menu_name\' => __( \'Books\', \'textdomain\' ),&#