WordPress开发者和主题制作者的搜索引擎



wp_maybe_grant_site_health_caps ›

Since5.2.2
已弃用n/a
wp_maybe_grant_site_health_caps ( $allcaps, $caps, $args, $user )
参数: (4)
  • (bool[]) $allcaps An array of all the user's capabilities.
    Required: Yes
  • (string[]) $caps Required primitive capabilities for the requested capability.
    Required: Yes
  • (array) $args { Arguments that accompany the requested capability check.
    Required: Yes
  • (WP_User) $user The user object.
    Required: Yes
返回:
  • (bool[]) Filtered array of the user's capabilities.
定义在:
文档:

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



源码

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