[wp-trac] [WordPress Trac] #60549: "Site Upload Quota Space" should indicate network default and possibly site's current usage
WordPress Trac
noreply at wordpress.org
Tue Aug 5 10:00:54 UTC 2025
#60549: "Site Upload Quota Space" should indicate network default and possibly
site's current usage
-------------------------------------------------+-------------------------
Reporter: MadtownLems | Owner: realloc
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.9
Component: Networks and Sites | Version:
Severity: normal | Resolution:
Keywords: has-test-info needs-design-feedback | Focuses: multisite
changes-requested |
-------------------------------------------------+-------------------------
Comment (by lenasterg):
Hi.
Thanks for the positive feedback and the thoughtful suggestion!
I’d suggest displaying the notice only when a site’s available upload
space drops below **25%** of its total quota. This way, users receive a
warning only when it’s truly relevant, avoiding unnecessary clutter for
those who still have plenty of space.
A suggestion to do it by using the built-in `get_space_used()` and
`get_space_allowed()` functions. To make the notice as unobtrusive as
possible, it should be shown **only on the Media Library admin page**
(`upload.php`) and **only for subsites**, not the main site.
A suggestion to do it:
{{{#!php
/**
* Display a warning notice in the Media Library admin page
* when the available upload space is less than 25% of the total quota.
*
* Applies only to subsites in a WordPress Multisite installation.
*/
add_action('admin_notices', 'custom_disk_space_warning');
function custom_disk_space_warning() {
global $pagenow;
// Only show notice on the Media Library page
if ($pagenow !== 'upload.php') {
return;
}
// Skip the main site (usually has no quota restrictions)
if (!is_main_site()) {
/**
* Get the total and used upload space for the current site.
* Both values are in megabytes (MB).
*/
$space_allowed = get_space_allowed(); // Total quota (MB)
$space_used = get_space_used(); // Used space (MB)
// Ensure quota is set and check if usage exceeds 75%
if ($space_allowed > 0 && ($space_used / $space_allowed) >= 0.75)
{
// Display warning notice if remaining space is below 25%
echo '<div class="notice notice-
warning"><p><strong>Warning:</strong> You have used more than 75% of your
available upload space.</p></div>';
}
}
}
}}}
This implementation ensures that the warning is shown **only when
needed**, and **only in the appropriate context**, providing a better and
less intrusive experience for multisite administrators.
Thanks again for raising this—refinements like these really help improve
usability at scale.
Replying to [comment:19 realloc]:
> Thanks everyone for the great work on this enhancement. It’s a very
helpful addition for multisite administrators.
>
> I’d also like to suggest going the last few meters and refining the
Media Library notice:
>
> Instead of always displaying it, it could appear only when a defined
threshold is reached. This would keep the interface clean for most users
while still drawing attention when action is needed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60549#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list