我正在尝试创建一个自定义角色,非常类似于admin,但没有编辑/删除插件的功能。因为我不习惯使用插件,所以我编辑了这些函数。php文件添加如下内容:
// Add a custom user role
$result = add_role( \'new_role\', __(
\'New Role\' ),
array(
\'edit_posts\' => true, // Allows user to edit their own posts
\'edit_pages\' => true, // Allows user to edit pages
\'edit_others_posts\' => true, // Allows user to edit others posts not just their own
\'create_posts\' => true, // Allows user to create new posts
\'manage_categories\' => true, // Allows user to manage post categories
\'publish_posts\' => true, // Allows the user to publish, otherwise posts stays in draft mode
\'edit_themes\' => true, // false denies this capability. User can’t edit your theme
\'install_plugins\' => false, // User cant add new plugins
\'update_plugin\' => true, // User can’t update any plugins
\'update_core\' => false // user cant perform core updates
)
);
之后,我可以用我的管理配置文件创建一个新用户,并为他分配我刚才创建的角色。一切都很好,直到我与新用户登录时,我只能访问网站的首页。
我试图在url后添加/wp admin,但收到消息:
抱歉,不允许您访问此页面
我试图在上面的数组中添加此行
\'manage_options\' => true, //not sure about that
但如果没有成功,障碍仍然存在
Question: How i can, without installing plugins, make a custom user role access the control panel?
谢谢大家