Changeset 45419 for trunk/src/wp-includes/class-wp-user.php
- Timestamp:
- 05/25/2019 10:26:22 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-user.php
r45418 r45419 713 713 714 714 /** 715 * Whether the user has a specific capability. 715 * Returns whether the user has the specified capability. 716 * 717 * This function also accepts an ID of an object to check against if the capability is a meta capability. Meta 718 * capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to 719 * map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`. 720 * 721 * Example usage: 722 * 723 * $user->has_cap( 'edit_posts' ); 724 * $user->has_cap( 'edit_post', $post->ID ); 725 * $user->has_cap( 'edit_post_meta', $post->ID, $meta_key ); 716 726 * 717 727 * While checking against a role in place of a capability is supported in part, this practice is discouraged as it … … 722 732 * @see map_meta_cap() 723 733 * 724 * @param string $cap Capability name. 725 * @param int ...$object_id Optional. ID of a specific object to check against if `$cap` is a "meta" capability. 726 * Meta capabilities such as `edit_post` and `edit_user` are capabilities used by 727 * by the `map_meta_cap()` function to map to primitive capabilities that a user or 728 * role has, such as `edit_posts` and `edit_others_posts`. 729 * @return bool Whether the user has the given capability, or, if `$object_id` is passed, whether the user has 734 * @param string $cap Capability name. 735 * @param mixed ...$args Optional further parameters, typically starting with an object ID. 736 * @return bool Whether the user has the given capability, or, if an object ID is passed, whether the user has 730 737 * the given capability for that object. 731 738 */
Note: See TracChangeset
for help on using the changeset viewer.