2020-05-02 / 5665阅 / 悠然
返回所提供的POST的作者是否具有指定的功能。
此函数还接受对象的ID,以检查该功能是否为元功能。元功能(例如edit_post和edit_user)是map_meta_cap()函数用于映射到用户或角色具有的原始功能(例如edit_posts和edit_others_posts)的功能。
用法示例:
author_can( $post, 'edit_posts' ); author_can( $post, 'edit_post', $post->ID ); author_can( $post, 'edit_post_meta', $post->ID, $meta_key );
(int|WP_Post)
(Required)
Post ID or post object.
(string)
(Required)
Capability name.
(mixed)
(Optional)
further parameters, typically starting with an object ID.
(bool) Whether the post author has the given capability.