发布时间:2020-09-17
WordPress 常用函数 / add_cap,
给指定的用户角色或者具体的某个用户添加特定的权限。
<?php global $wp_roles; $wp_roles->add_cap( $role, $cap ); ?>
$role WP_Roles 类中才有该参数,WP_Role 和 WP_User 类中没有该参数。
(string) (Required) 用户角色名称
Default: None
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
$cap
(string) (Required) 权限名称
Default: None
$grant
(boolean) (optional) 是否该用户拥有该权限
Default: true
无
Since 2.0.0
wp-includes/capabilities.php
全站搜索