Automattic\WooCommerce\Internal\Utilities
Users::is_site_administrator()
Indicates if the user qualifies as site administrator.
In the context of multisite networks, this means that they must have the manage_sites capability. In all other cases, they must have the manage_options capability.
Метод класса: Users{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = Users::is_site_administrator( $user_id ): bool;
- $user_id(int)
- Optional, used to specify a specific user (otherwise we look at the current user).
Код Users::is_site_administrator() Users::is site administrator WC 9.3.3
public static function is_site_administrator( int $user_id = 0 ): bool { $user = 0 === $user_id ? wp_get_current_user() : get_user_by( 'id', $user_id ); if ( false === $user ) { return false; } return is_multisite() ? $user->has_cap( 'manage_sites' ) : $user->has_cap( 'manage_options' ); }