Wordpress用户角色,只能编辑具有其他用户角色的用户?

时间:2017-07-20 01:14:02

标签: wordpress

我创建了一个新的用户角色,但我需要此用户角色才能编辑具有其他用户角色的用户,我不希望这个新用户角色能够编辑用户,如编辑,作者等。 ..

想法?

1 个答案:

答案 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

编辑:

阅读这篇文章:了解如何向用户添加编辑特定角色的功能...... How to allow an user role to create a new user under a role which lower than his level only?

我希望你解决它......好看! ;)

相关问题