author_can

Definition:
function author_can( $post, $capability ) {}

Whether author of supplied post has capability or role.

Parameters

  • int|object $post: Post ID or post object.
  • string $capability: Capability or role name.

Source code

function author_can( $post, $capability ) {

	if ( !$post = get_post($post) )

		return false;



	$author = new WP_User( $post->post_author );



	if ( empty( $author->ID ) )

		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 );

}

545

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: