Warning: This function has been deprecated. Use is_super_admin() instead.

is_site_admin() WordPress Function

The is_site_admin() function is used to check if the current user is an administrator of the site. This function returns true if the user is an administrator, and false if the user is not an administrator.

is_site_admin( string $user_login = '' ) #

Determine if user is a site admin.


Description

Plugins should use is_multisite() instead of checking if this function exists to determine if multisite is enabled.

This function must reside in a file included only if is_multisite() due to legacy function_exists() checks to determine if multisite is enabled.

Top ↑

See also


Top ↑

Parameters

$user_login

(string)(Optional) Username for the user to check.

Default value: ''


Top ↑

Source

File: wp-includes/ms-deprecated.php

function is_site_admin( $user_login = '' ) {
	_deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' );

	if ( empty( $user_login ) ) {
		$user_id = get_current_user_id();
		if ( !$user_id )
			return false;
	} else {
		$user = get_user_by( 'login', $user_login );
		if ( ! $user->exists() )
			return false;
		$user_id = $user->ID;
	}

	return is_super_admin( $user_id );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Use is_super_admin()
MU (3.0.0)Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.