Warning: Undefined array key -1 in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line
185
Warning: Undefined array key 2 in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line
186
Warning: Undefined variable $searchand in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line
154
Warning: Undefined array key "8d3b41dcb66259518ecadc6a33fd54cb" in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line
223
Warning: Undefined variable $searchand in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line
154
Warning: Undefined array key "c1a818a38c2857eb318d2766bd35f8b7" in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line
223
描述
此函数还接受对象的ID,以检查该能力是否为meta能力。meta能力(如edit_post和edit_user)是map_meta_cap()函数用来映射到用户或角色具有的基本能力(如,edit_posts与edit_others_posts)的能力。
用法示例:
user_can( $user->ID, 'edit_posts' );
user_can( $user->ID, 'edit_post', $post->ID );
user_can( $user->ID, 'edit_post_meta', $post->ID, $meta_key );
参数
- $user
-
(int|WP_User)(必填) 用户ID或对象。
- $capability
-
(string)(必填) 能力名称。
- $args
-
(mixed)(可选) 通常以对象ID开始的其他参数。
返回
(bool) Whether the user has the given capability.
(bool) 用户是否具有给定能力。
更新日志
| 版本 | 描述 |
|---|
| 5.3.0 | 通过将现有的...$args参数添加到函数签名中,将其形参化。 |
| 3.1.0 | 开始引入 |
Warning: Undefined variable $o in
/www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference.php on line
194