wp_maybe_grant_site_health_caps()WP 5.2.2

Filters the user capabilities to grant the 'view_site_health_checks' capabilities as necessary.

Хуков нет.


true|false[]. Filtered array of the user's capabilities.


wp_maybe_grant_site_health_caps( $allcaps, $caps, $args, $user );
$allcaps(bool[]) (обязательный)
An array of all the user's capabilities.
$caps(string[]) (обязательный)
Required primitive capabilities for the requested capability.
$args(массив) (обязательный)

Arguments that accompany the requested capability check.

  • 0(строка)
    Requested capability.

  • 1(int)
    Concerned user ID.

  • ...$2(разное)
    Optional second and further parameters, typically object ID.
$user(WP_User) (обязательный)
The user object.

Список изменений

С версии 5.2.2 Введена.

Код wp_maybe_grant_site_health_caps() WP 6.3.1

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;