我正在使用函数中的以下代码创建自定义用户角色。php,然而WordPress只允许用户创建草稿页面,即使我将这些功能设置为true,他们也不能编辑草稿页面或发布页面?
非常感谢您的帮助!。提前谢谢。
add_action(\'admin_init\', \'user_custom_roles\');
function user_custom_roles() {
add_role(
\'editor_limited\',
\'Editor Limited\',
array(
\'read\' => true,
\'edit_pages\' => true,
\'edit_posts\' => true,
\'edit_published_pages\' => true,
\'edit_published_posts\' => true,
\'edit_others_pages\' => true,
\'edit_others_posts\' => true,
\'publish_pages\' => true,
\'publish_posts\' => true,
\'upload_files\' => true,
\'unfiltered_html\' => true
)
);
}
SO网友:VinothRaja
只需将以下代码添加到当前活动主题中。删除add\\u操作(&U);功能。只需粘贴下面的代码
$result = add_role( \'client\', __(
\'Client\' ),
array(
\'read\' => true,
\'edit_pages\' => true,
\'edit_posts\' => true,
\'edit_published_pages\' => true,
\'edit_published_posts\' => true,
\'edit_others_pages\' => true,
\'edit_others_posts\' => true,
\'publish_pages\' => true,
\'publish_posts\' => true,
\'upload_files\' => true,
\'unfiltered_html\' => true
)
);