Summery Summery
Whether the author of the supplied post has a specific capability.
Syntax Syntax
Parameters Parameters
- $post
-
(Required) Post ID or post object.
- $capability
-
(Required) Capability name.
Return Return
(bool) Whether the post author has the given capability.
Source Source
File: wp-includes/capabilities.php
* @param int $blog_id Site ID. * @param string $capability Capability name. * @param mixed ...$args Optional further parameters, typically starting with an object ID. * @return bool Whether the user has the given capability. */ function current_user_can_for_blog( $blog_id, $capability, ...$args ) { $switched = is_multisite() ? switch_to_blog( $blog_id ) : false; $current_user = wp_get_current_user(); if ( empty( $current_user ) ) { if ( $switched ) { restore_current_blog(); } return false; }
Advertisement
Changelog Changelog
Version | Description |
---|---|
2.9.0 | Introduced. |