Using WordPress ‘is_super_admin()’ PHP function

The is_super_admin() WordPress PHP function determines whether a user is a site admin.


is_super_admin( $user_id )

Custom example:

Input: is_super_admin( 1 )

Output: true (assuming user with ID 1 is a super admin)


  • $user_id (int|false) – Optional. The ID of a user. Defaults to false, to check the current user. Default: false

More information

See WordPress Developer Resources: is_super_admin

Important: As of WordPress 4.8, the use of is_super_admin is discouraged. Use the setup_network capability check instead.


Remove “Edit” menu for non-super admins

This code removes the “Edit” menu for users who are not super admins of a multisite network.

if ( ! is_super_admin() ) {
    add_action( 'admin_init', 'wpdocs_remove_edit_menu' );

function wpdocs_remove_edit_menu() {

Use setup_network capability instead of is_super_admin

This code demonstrates the use of the setup_network capability check instead of is_super_admin.

if ( current_user_can( 'setup_network' ) ) {
    // do something

Display hooks for super admin only

This code displays hooks for super admin users only.

if ( is_super_admin() ) {
    $debug_tags = array();
    add_action( 'all', function ( $tag ) {
        global $debug_tags;
        if ( in_array( $tag, $debug_tags ) ) {
        echo "<pre>" . $tag . "</pre>";
        $debug_tags = $tag;
    } );

Show a message for super admin users

This code displays a message for super admin users only.

function wpdocs_display_super_admin_message() {
    if ( is_super_admin() ) {
        echo "Hello, super admin!";
add_action( 'admin_notices', 'wpdocs_display_super_admin_message' );

Restrict access to a custom admin page for super admins only

This code restricts access to a custom admin page for super admins only.

function wpdocs_restrict_custom_page() {
    if ( ! is_super_admin() ) {
        wp_die( 'You do not have sufficient permissions to access this page.' );
    // Your custom admin page content
add_action( 'admin_menu', 'wpdocs_restrict_custom_page' );