WordPress函数文档add_cap()
给指定的用户角色添加特定的权限 描述 Adds a capability to a role or speci…
给指定的用户角色添加特定的权限
描述
Adds a capability to a role or specific user. Changing the capabilities of a role or user is persistent, meaning the added capability will stay in effect until explicitly revoked.
N.B.: This setting is saved to the database (in table wp_options, field wp_user_roles), so it might be better to run this on theme/plugin activation
参数
role (just with WP_Roles)
(string) (必填) role name
默认值: None
cap
(string) (必填) capability name
默认值: None
grant
(boolean) (可选) Whether the role is capable of performing this capability.
默认值: true
返回值
void
No return value
注意
There is no public function called add_cap()
– just the class methods inside WP_Roles
, WP_Role
, WP_User
that can add capabilities.
If you want to add a new role with capabilities, just add them when you add the role using add_role();
.
源文件
add_cap 函数的代码位于 wp-includes/capabilities.php
.
相关
Roles and Capabilities:
- add_role()
- remove_role()
- get_role()
- add_cap()
- remove_cap()
- 原文:http://codex.wordpress.org/Function_Reference/add_cap
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!