如何在WordPress中为用户角色添加或删除功能

WordPress comes with a simple but powerful user management system. Each user has capabilities based on the roles they are assigned. As the administrator, you have the ability to perform all actions on your WordPress site. However, if you are running a multi-author WordPress site, then you might find a need to modify capabilities of some user roles, or create custom user roles with capabilities defined by you. In this article, we will show you how to add or remove capabilities to roles in WordPress. We will also show you how to create your own custom user roles.

WordPress附带了一个简单但功能强大的用户管理系统。 每个用户都具有根据其分配的角色而定的功能。 作为管理员,您可以在WordPress网站上执行所有操作。 但是,如果您正在运行多作者WordPress网站 ,则可能需要修改某些用户角色的功能,或者使用您定义的功能创建自定义用户角色。 在本文中,我们将向您展示如何在WordPress中为角色添加或删除功能。 我们还将向您展示如何创建自己的自定义用户角色。

In WordPress, each user role has permission levels that allows them to perform certain tasks on the website. You can give additional capabilities to an existing user role, or take away their capability to perform certain action on the website. You can see the full user role table here.

在WordPress中,每个用户角色都有权限级别,该权限级别允许他们在网站上执行某些任务。 您可以为现有用户角色提供其他功能,也可以剥夺他们在网站上执行某些操作的功能。 您可以在此处查看完整的用户角色表

First thing you need to do is install and activate the Capability Manager Enhanced plugin. After activating the plugin, go to Users » Capabilities.

您需要做的第一件事是安装并激活Capability Manager Enhanced插件。 激活插件后,转到“ 用户”»“功能”

编辑用户角色的权限和功能 (Editing Permissions and Capabilities for a User Role)

From the capability manager screen, you can load a user role to edit capabilities of all users under that particular user role.

在功能管理器屏幕中,您可以加载用户角色以编辑该特定用户角色下所有用户的功能。

Select and load a role you want to edit

Checking the box next to the particular capability option will enable the users in the selected role to perform that action. For example if you are editing Subscriber user role, and you check the Edit box next to Posts under editing capabilities, then it will enable subscribers to create posts.

选中特定功能选项旁边的框,将使处于所选角色的用户能够执行该操作。 例如,如果您正在编辑订户用户角色,并在编辑功能下选中“帖子”旁边的“编辑”框,则它将使订阅者能够创建帖子。

Select capabilities for a user role

The plugin is simple to use, but it is very powerful. Please be careful and understand what each permission level means.

该插件易于使用,但功能非常强大。 请小心并了解每个权限级别的含义。

添加具有自定义功能和权限的自定义用户角色 (Adding Custom User Role with Custom Capabilities and Permissions)

From the same capabilities screen, create a new user role by providing a name for the role in Create New Role box on the right. For e.g. Senior Editor, Junior Copywriter, or Support Staff.

在同一功能屏幕上,通过在右侧的“创建新角色”框中提供角色名称来创建新用户角色。 例如,高级编辑,初级撰稿人或支持人员。

Creating a custom user role in WordPress

After creating a new user role, you can assign capabilities to that particular user role by loading it. Again don’t forget to assign read permission to the user role if you want users under that role to access the admin area.

创建新的用户角色后,您可以通过加载该特定用户角色来为其分配功能。 同样,如果您希望该角色下的用户访问管理区域,请不要忘记为该用户角色分配读取权限。

We hope that this article helped you learn how to add or remove capabilities to user roles and create custom user roles in WordPress. For questions and feedback please leave a comment below.

我们希望本文能帮助您学习如何在WordPress中添加或删除用户角色功能以及创建自定义用户角色。 对于问题和反馈,请在下面留下评论。

翻译自: https://www.wpbeginner.com/plugins/how-to-add-or-remove-capabilities-to-user-roles-in-wordpress/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值