Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_maybe_grant_site_health_caps ›

Depuis5.2.2
Dépréciéen/a
wp_maybe_grant_site_health_caps ( $allcaps, $caps, $args, $user )
Paramètres: (4)
  • (bool[]) $allcaps An array of all the user's capabilities.
    Requis: Oui
  • (string[]) $caps Required primitive capabilities for the requested capability.
    Requis: Oui
  • (array) $args { Arguments that accompany the requested capability check.
    Requis: Oui
  • (WP_User) $user The user object.
    Requis: Oui
Retourne:
  • (bool[]) Filtered array of the user's capabilities.
Défini(e) dans:
Codex:

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



Source

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