# Show Upload Space Used in the Admin Bar

> Shows site admins how much of their upload quota they have used, as a percentage in the toolbar, turning amber at 75% and red at 90%.

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

## Code

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

add_action( 'admin_bar_menu', function ( $bar ) {
    if ( ! is_admin() || ! current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) {
        return;
    }

    $allowed = (float) get_space_allowed();

    if ( $allowed <= 0 ) {
        return;
    }

    $used    = (float) get_space_used();
    $percent = min( 100, (int) round( $used / $allowed * 100 ) );
    $color   = $percent >= 90 ? '#f86368' : ( $percent >= 75 ? '#f0b849' : 'inherit' );

    $bar->add_node( array(
        'id'    => 'wpide-storage',
        'title' => sprintf( '<span style="color:%1$s">%2$s</span>', esc_attr( $color ), esc_html( sprintf( 'Storage %d%%', $percent ) ) ),
        'href'  => admin_url( 'upload.php' ),
        'meta'  => array(
            'title' => sprintf( '%1$s of %2$s used', size_format( (int) ( $used * MB_IN_BYTES ), 1 ), size_format( (int) ( $allowed * MB_IN_BYTES ) ) ),
        ),
    ) );
}, 90 );
```

## Notes

Hidden when the network has upload space checks turned off.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show Upload Space Used 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/
