尝试授予用户角色以编辑其他用户:
$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');
答案 0 :(得分:0)
您可以添加角色:
$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