wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_maybe_grant_site_health_caps › WordPress Function

Seit5.2.2
Veraltetn/v
wp_maybe_grant_site_health_caps ( $allcaps, $caps, $args, $user )
Parameter: (4)
  • (bool[]) $allcaps An array of all the user's capabilities.
    Erforderlich: Ja
  • (string[]) $caps Required primitive capabilities for the requested capability.
    Erforderlich: Ja
  • (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. }
    Erforderlich: Ja
  • (WP_User) $user The user object.
    Erforderlich: Ja
Gibt zurück:
  • (bool[]) Filtered array of the user's capabilities.
Definiert in:
Codex:

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



Quellcode

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;
}