Un motore di ricerca WordPress per sviluppatori e autori di temi



author_can ›

Da2.9.0
Deprecaton/a
author_can ( $post, $capability )
Parametri: (2)
  • (int|WP_Post) $post Post ID or post object.
    Richiesto:
  • (string) $capability Capability name.
    Richiesto:
Ritorna:
  • (bool) Whether the post author has the given capability.
Definito a:
Codex:

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



Sorgenti

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