Storage Used Column in the Network Sites List
Shows how much upload space each site uses next to its quota in Network Admin > Sites, highlighting sites that are close to the limit.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
$wpide_warn_at = 80; // Highlight sites using more than this percentage of their quota.
add_filter( 'wpmu_blogs_columns', function ( $columns ) {
$columns['wpide_storage'] = __( 'Storage' );
return $columns;
} );
add_action( 'manage_sites_custom_column', function ( $column, $blog_id ) use ( $wpide_warn_at ) {
if ( 'wpide_storage' !== $column ) {
return;
}
switch_to_blog( $blog_id );
$used = (float) get_space_used();
$allowed = (float) get_space_allowed();
restore_current_blog();
if ( get_site_option( 'upload_space_check_disabled' ) || $allowed <= 0 ) {
echo esc_html( size_format( (int) ( $used * MB_IN_BYTES ), 1 ) );
return;
}
$percent = min( 100, round( $used / $allowed * 100 ) );
$style = $percent >= $wpide_warn_at ? ' style="color:#b32d2e;font-weight:600"' : '';
printf(
'<span%1$s>%2$s / %3$s (%4$d%%)</span>',
$style, // phpcs:ignore WordPress.Security.EscapeOutput -- static markup.
esc_html( size_format( (int) ( $used * MB_IN_BYTES ), 1 ) ),
esc_html( size_format( (int) ( $allowed * MB_IN_BYTES ) ) ),
(int) $percent
);
}, 10, 2 );
Notes
Disk usage is computed by WordPress and cached per site; sites with uploads unlimited show only the used size.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.