# Show the Current Site ID in the Admin Bar

> Shows super admins the blog ID of the site they are on in the toolbar, with links to that site's Network Admin edit screens.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: admin-bar, site-id, super-admin
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-admin-bar-site-id/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

add_action( 'admin_bar_menu', function ( $bar ) {
    if ( ! is_super_admin() ) {
        return;
    }

    $id = get_current_blog_id();

    $bar->add_node( array(
        'id'    => 'wpide-site-id',
        'title' => esc_html( sprintf( 'Site #%d', $id ) ),
        'href'  => network_admin_url( 'site-info.php?id=' . $id ),
        'meta'  => array( 'title' => __( 'Edit this site in Network Admin' ) ),
    ) );

    foreach ( array( 'site-info.php' => 'Info', 'site-users.php' => 'Users', 'site-themes.php' => 'Themes', 'site-settings.php' => 'Settings' ) as $path => $label ) {
        $bar->add_node( array(
            'parent' => 'wpide-site-id',
            'id'     => 'wpide-site-id-' . sanitize_key( $label ),
            'title'  => esc_html( $label ),
            'href'   => network_admin_url( $path . '?id=' . $id ),
        ) );
    }
}, 999 );
```

## Notes

Only visible to super admins.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show the Current Site ID in the Admin Bar" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
