On this page
get_upload_space_available(): int
Determines if there is any upload space left in the current blog’s quota.
Return
int of upload space available in bytes
Source
File: wp-includes/ms-functions.php. View all references
function get_upload_space_available() {
$allowed = get_space_allowed();
if ( $allowed < 0 ) {
$allowed = 0;
}
$space_allowed = $allowed * MB_IN_BYTES;
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return $space_allowed;
}
$space_used = get_space_used() * MB_IN_BYTES;
if ( ( $space_allowed - $space_used ) <= 0 ) {
return 0;
}
return $space_allowed - $space_used;
}
Related
Uses
| Uses | Description |
|---|---|
| get_space_used() wp-includes/ms-functions.php | Returns the space used by the current site. |
| get_space_allowed() wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| get_site_option() wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Attachments_Controller::check_upload_size() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Determine if uploaded file exceeds space quota on multisite. |
| fix_import_form_size() wp-admin/includes/ms.php | Get the remaining upload space for this site. |
| check_upload_size() wp-admin/includes/ms.php | Determine if uploaded file exceeds space quota. |
| is_upload_space_available() wp-includes/ms-functions.php | Determines if there is any upload space left in the current blog’s quota. |
| upload_size_limit_filter() wp-includes/ms-functions.php | Filters the maximum upload file size allowed, in bytes. |
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_upload_space_available