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

Whether the author of the supplied post has a specific capability.


Parameters

$post

(Required) Post ID or post object.

$capability

(Required) Capability name.


Return

(bool) Whether the post author has the given capability.


Source

File: wp-includes/capabilities.php

function author_can( $post, $capability ) {
	if ( !$post = get_post($post) )
		return false;

	$author = get_userdata( $post->post_author );

	if ( ! $author )
		return false;

	$args = array_slice( func_get_args(), 2 );
	$args = array_merge( array( $capability ), $args );

	return call_user_func_array( array( $author, 'has_cap' ), $args );
}


Changelog

Changelog
Version Description
WP-2.9.0 Introduced.