wp_maybe_grant_site_health_caps

The timeline below displays how wordpress function wp_maybe_grant_site_health_caps has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: .10

/**
 * Filters the user capabilities to grant the 'view_site_health_checks' capabilities as necessary.
 *
 * @since 5.2.2
 *
 * @param bool[]   $allcaps An array of all the user's capabilities.
 * @param string[] $caps    Required primitive capabilities for the requested capability.
 * @param array    $args {
 *     Arguments that accompany the requested capability check.
 *
 *     @type string    $0 Requested capability.
 *     @type int       $1 Concerned user ID.
 *     @type mixed  ...$2 Optional second and further parameters, typically object ID.
 * }
 * @param WP_User  $user    The user object.
 * @return bool[] Filtered array of the user's capabilities.
 */
function wp_maybe_grant_site_health_caps($allcaps, $caps, $args, $user)
{
    if (!empty($allcaps['install_plugins']) && (!is_multisite() || is_super_admin($user->ID))) {
        $allcaps['view_site_health_checks'] = true;
    }
    return $allcaps;
}