WordPress的用户提供角色编辑用户
问题描述:
试图让用户角色编辑其他用户:WordPress的用户提供角色编辑用户
$edit_editor = get_role('designer');
$edit_editor->add_cap('edit_users');
$edit_editor->add_cap('list_users');
$edit_editor->add_cap('promote_users');
$edit_editor->add_cap('create_users');
$edit_editor->add_cap('add_users');
$edit_editor->add_cap('delete_users');
答
您可以添加角色,所以:
$result = add_role(
'editor_of_users',
__('Editor of Users'),
array(
'edit_users' => true,
// Add more capabilities...
)
);
if (null !== $result) {
echo 'Yay! New role created!';
}
else {
echo 'Oh... the editor_of_users role already exists.';
}
欲了解更多信息,您可以显示为红色约文档:add_role
而这里的所有用户的功能:Roles and Capabilities