Title: author_can
Published: April 25, 2014
Last modified: February 24, 2026

---

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

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#wp--skip-link--target)

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

## 󠀁[Description](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#description)󠁿

This function also accepts an ID of an object to check against if the capability
is a meta capability. Meta capabilities such as `edit_post` and `edit_user` are 
capabilities used by the `map_meta_cap()` function to map to primitive capabilities
that a user or role has, such as `edit_posts` and `edit_others_posts`.

Example usage:

    ```php
    author_can( $post, 'edit_posts' );
    author_can( $post, 'edit_post', $post->ID );
    author_can( $post, 'edit_post_meta', $post->ID, $meta_key );
    ```

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#parameters)󠁿

 `$post`int|[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)
required

Post ID or post object.

`$capability`stringrequired

Capability name.

`$args`mixedoptional

Optional further parameters, typically starting with an object ID.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#return)󠁿

 bool Whether the post author has the given capability.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#source)󠁿

    ```php
    function author_can( $post, $capability, ...$args ) {
    	$post = get_post( $post );
    	if ( ! $post ) {
    		return false;
    	}

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

    	if ( ! $author ) {
    		return false;
    	}

    	return $author->has_cap( $capability, ...$args );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/capabilities.php#L973)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/capabilities.php#L973-L986)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#related)󠁿

| Uses | Description | 
| [get_userdata()](https://developer.wordpress.org/reference/functions/get_userdata/)`wp-includes/pluggable.php` |

Retrieves user info by user ID.

  | 
| [get_post()](https://developer.wordpress.org/reference/functions/get_post/)`wp-includes/post.php` |

Retrieves post data given a post ID or post object.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. | 
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/author_can/?output_format=md#comment-content-1535)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/author_can/#comment-1535)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fauthor_can%2F%23comment-1535)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fauthor_can%2F%23comment-1535)
 4. **Example**
 5.     ```php
        if ( author_can( $post->ID, 'publish_posts' ) ) {
        	echo __( 'Yes they can publish posts!', 'textdomain' );
        }
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fauthor_can%2F%3Freplytocom%3D1535%23feedback-editor-1535)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fauthor_can%2F)
before being able to contribute a note or feedback.