A WordPress-centric search engine for devs and theme authors



author_can ›

Since2.9.0
Deprecatedn/a
author_can ( $post, $capability )
Parameters: (2)
  • (int|WP_Post) $post Post ID or post object.
    Required: Yes
  • (string) $capability Capability name.
    Required: Yes
Returns:
  • (bool) Whether the post author has the given capability.
Defined at:
Codex:

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



Source

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