author_can()

author_can()函数是Wordpress函数

author_can( int|WP_Post $post, string $capability, mixed $args )

返回所提供文章的作者是否具有指定的功能。

Returns whether the author of the supplied post has the specified capability.

说明(Description)

此函数还接受一个对象的ID,以检查该功能是否为元功能。元功能(如edit_post和edit_user)是map_Meta_cap()函数用来映射到用户或角色具有的基本功能(如edit_posts和edit_others_posts)的功能。

示例用法:

作者可以($post,’edit_posts’);

作者可以($post,’edit_post’,$post->ID);

作者可以($post,’edit_post_meta’,$post->ID,$meta_key);


参数(Parameters)

参数类型必填说明
$post(int | WP_Post)必需Post ID或Post对象。
$capability(string)必需能力名称。
$args(mixed)可选其他参数,通常以对象ID开头。

返回(Return)

(bool)文章作者是否具有给定的能力。


源码(Source)

//暂无
更新版本源码位置使用被使用
5.3.0wp-includes/capabilities.php:73402
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索