WordPress Multisite Security: Capabilities, Roles, and Audit Logging

Multisite permissions: super admins, site admins and what they can do

In a single WordPress site, an administrator can do everything. In a Multisite network, there are two levels: super admins manage the network (themes, plugins, sites, users), site administrators manage their own site but cannot install code or add unfiltered HTML. Misunderstanding these levels leads to the two classic problems: too many super admins, or plugin code that checks the wrong capability and opens a hole on every site.

Problem: A university network has 40 sites. Eight people are super admins “so they can help”, and a custom plugin lets site administrators change a network-wide setting because it checks manage_options, which every site admin has.

Solution: Keep the number of super admins minimal and review it with WP-CLI, check network-level actions with manage_network_options (or is_super_admin() where no specific capability exists), keep unfiltered_html away from site admins, and log role changes and new super admins.

The two levels

  • Super admin: stored in the network option site_admins, not as a role. A super admin passes almost every capability check on every site (current_user_can() returns true unless a capability is explicitly denied by do_not_allow).
  • Administrator of a site: a normal role on that site. In Multisite it lacks the capabilities install_plugins, edit_plugins, edit_themes, update_core and unfiltered_html, which only super admins get.

Review the super admins

wp super-admin list
wp super-admin remove olduser
wp user list --network --field=user_login --role=administrator --url=site2.example.com

Every super admin can install a plugin that runs on every site of the network, so this list deserves the same care as the server’s root access. Granting and revoking fire the actions granted_super_admin and revoked_super_admin, which a log can use:

add_action( 'granted_super_admin', function ( int $user_id ): void {
    $actor = wp_get_current_user();
    error_log( sprintf( '[network] super admin granted to user %d by %s', $user_id, $actor->user_login ?: 'cli' ) );
} );

Check the right capability in plugin code

// Network settings page: only for the network
add_action( 'network_admin_menu', function (): void {
    add_submenu_page(
        'settings.php',
        __( 'HA Network Settings', 'textdomain' ),
        __( 'HA Settings', 'textdomain' ),
        'manage_network_options',
        'ha-network',
        'ha_render_network_settings'
    );
} );

add_action( 'network_admin_edit_ha_network', function (): void {
    check_admin_referer( 'ha_network' );
    if ( ! current_user_can( 'manage_network_options' ) ) {
        wp_die( esc_html__( 'Not allowed.', 'textdomain' ), 403 );
    }
    update_site_option( 'ha_api_endpoint', esc_url_raw( wp_unslash( $_POST['ha_api_endpoint'] ?? '' ) ) );
    wp_safe_redirect( network_admin_url( 'settings.php?page=ha-network&updated=1' ) );
    exit;
} );

Network-wide settings are stored with update_site_option() in wp_sitemeta; a site’s own settings with update_option(). A form that changes a site option must check manage_options; a form that changes a network option must check a network capability. manage_options on a network setting means every one of the 40 site admins can change it.

unfiltered_html

Site admins in Multisite cannot post JavaScript in content: unfiltered_html is reserved for super admins, and KSES filters their HTML. Plugins that add “custom code” fields for site admins (tracking scripts, custom CSS with </style> escapes) bypass exactly this protection. If such a field is needed, restrict it to unfiltered_html:

if ( current_user_can( 'unfiltered_html' ) ) {
    update_option( 'ha_head_code', wp_unslash( $_POST['ha_head_code'] ) );
} else {
    update_option( 'ha_head_code', wp_kses_post( wp_unslash( $_POST['ha_head_code'] ) ) );
}

Custom roles and capabilities, including capabilities that depend on the object: custom roles and capabilities. Network-wide queries across sites: get_sites() and switch_to_blog().

NOTE: is_super_admin() checks the network list, not a capability, and cannot be changed with map_meta_cap. Prefer specific capabilities (manage_network_options, manage_sites, manage_network_users) in plugin code, so that a site with custom capability mapping keeps control over who may do what.