我正在为客户创建这个角色“杂货店”,但它基本上只需要能够编辑页面和上传媒体。出于某种原因,我的代码仍然允许“杂货店”角色删除帖子和创建页面,并做一些我不希望这个角色能够做的事情。这是我的代码,我不明白为什么它不工作。它添加了角色并允许我在此角色下创建用户,但它再次允许了错误的操作。
// Give capabilities
$capabilities_grocery = array(
\'activate_plugins\' => false,
\'delete_others_pages\' => false,
\'delete_others_posts\' => false,
\'delete_pages\' => false,
\'delete_posts\' => false,
\'delete_private_pages\' => false,
\'delete_private_posts\' => false,
\'delete_published_pages\' => false,
\'delete_published_posts\' => false,
\'edit_dashboard\' => false,
\'edit_others_pages\' => true,
\'edit_others_posts\' => true,
\'edit_pages\' => true,
\'edit_posts\' => true,
\'edit_private_pages\' => true,
\'edit_private_posts\' => true,
\'edit_published_pages\' => true,
\'edit_published_posts\' => true,
\'edit_theme_options\' => false,
\'export\' => true,
\'import\' => true,
\'list_users\' => false,
\'manage_categories\' => false,
\'manage_links\' => false,
\'manage_options\' => false,
\'moderate_comments\' => false,
\'promote_users\' => false,
\'publish_pages\' => false,
\'publish_posts\' => false,
\'read_private_pages\' => false,
\'read_private_posts\' => false,
\'read\' => true,
\'remove_users\' => false,
\'switch_themes\' => false,
\'upload_files\' => true,
\'customize\' => false,
\'delete_site\' => false,
);
// Add The Role
add_role(\'grocery\', \'Grocery\', $capabilities_grocery);