author_can [ WordPress Function ]
author_can ( $post, $capability )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Whether author of supplied post has capability or role.
Source
<?php
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 );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/author can « WordPress Codex
Description. Whether author of supplied post has capability or role. Usage. <?php author_can( $post, $capability ); ?> Example. Parameters. $post: (mixed) ...
codex.wordpress.org - WordPress › Support » Use author_can() on custom post types?
I'm trying to conditionally display some content in a theme using custom roles and capabilities. First, I define a custom role: add_role('free_vendor', 'Free Vendor ...
wordpress.org - roles - Using author_can() on custom post types in WordPress ...
Jan 18, 2011 ... if (author_can($post, 'display_map')) echo '<li><a ... Is there some issue in using author_can() with custom post types? Am I not calling ...
wordpress.stackexchange.com - author_can() WordPress function reference, arguments and source ...
Whether author of supplied post has capability or role.
queryposts.com