WordPress.org

Make WordPress Core

Ticket #42589: 42589.diff

File 42589.diff, 1.7 KB (added by mariovalney, 3 years ago)
  • wp-includes/capabilities.php

    diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
    index e744175..2ffa5f0 100644
    a b function author_can( $post, $capability ) { 
    666666/**
    667667 * Whether a particular user has a specific capability.
    668668 *
     669 * While checking against particular roles in place of a capability is supported
     670 * in part, this practice is discouraged as it may produce unreliable results.
     671 *
     672 * Note: Will always return true if the current user is a super admin, unless specifically denied.
     673 *
    669674 * @since 3.1.0
    670675 *
    671  * @param int|WP_User $user       User ID or object.
    672  * @param string      $capability Capability name.
    673  * @return bool Whether the user has the given capability.
     676 * @see WP_User::has_cap()
     677 * @see map_meta_cap()
     678 *
     679 * @param int|WP_User $user  User ID or object.
     680 * @param string $capability Capability name.
     681 * @param int    $object_id  Optional. ID of the specific object to check against if `$capability` is a "meta" cap.
     682 *                           "Meta" capabilities, e.g. 'edit_post', 'edit_user', etc., are capabilities used
     683 *                           by map_meta_cap() to map to other "primitive" capabilities, e.g. 'edit_posts',
     684 *                           'edit_others_posts', etc. Accessed via func_get_args() and passed to WP_User::has_cap(),
     685 *                           then map_meta_cap().
     686 * @return bool Whether the current user has the given capability. If `$capability` is a meta cap and `$object_id` is
     687 *              passed, whether the current user has the given meta capability for the given object.
    674688 */
    675689function user_can( $user, $capability ) {
    676690        if ( ! is_object( $user ) )