wp_dashboard_quota

The timeline below displays how wordpress function wp_dashboard_quota has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Displays file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return true|void True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: %s: Number of megabytes. */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf(
        '<a href="%1$s">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
        esc_url(admin_url('upload.php')),
        $text,
        /* translators: Hidden accessibility text. */
        __('Manage Uploads')
    );
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: Number of megabytes, 2: Percentage. */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf(
        '<a href="%1$s" class="musublink">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
        esc_url(admin_url('upload.php')),
        $text,
        /* translators: Hidden accessibility text. */
        __('Manage Uploads')
    );
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 6.2

/**
 * Displays file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return true|void True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: %s: Number of megabytes. */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf(
        '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
        esc_url(admin_url('upload.php')),
        $text,
        /* translators: Hidden accessibility text. */
        __('Manage Uploads')
    );
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: Number of megabytes, 2: Percentage. */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf(
        '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
        esc_url(admin_url('upload.php')),
        $text,
        /* translators: Hidden accessibility text. */
        __('Manage Uploads')
    );
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 5.7

/**
 * Displays file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return true|void True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: %s: Number of megabytes. */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: Number of megabytes, 2: Percentage. */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 5.4

/**
 * Displays file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: %s: Number of megabytes. */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: Number of megabytes, 2: Percentage. */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 5.3

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: %s: Number of megabytes. */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: Number of megabytes, 2: Percentage. */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 4.9

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: %s: number of megabytes */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: number of megabytes, 2: percentage */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 4.6

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the {@see 'activity_box_end'} hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: number of megabytes */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: number of megabytes, 2: percentage */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 4.5

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the activity_box_end hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
 */
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: number of megabytes */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: number of megabytes, 2: percentage */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', esc_url(admin_url('upload.php')), $text, __('Manage Uploads'));
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 4.4

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the activity_box_end hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
*/
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h3 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h3>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: number of megabytes */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s" title="%2$s">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: number of megabytes, 2: percentage */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" title="%2$s" class="musublink">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 4.1

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the activity_box_end hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
*/
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h4 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h4>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: number of megabytes */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s" title="%2$s">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: number of megabytes, 2: percentage */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" title="%2$s" class="musublink">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 3.8

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the activity_box_end hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool True if not multisite, user can't upload files, or the space check option is disabled.
*/
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_class = ($percentused >= 70) ? ' warning' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<h4 class="mu-storage"><?php 
    _e('Storage Space');
    ?></h4>
	<div class="mu-storage">
	<ul>
		<li class="storage-count">
			<?php 
    $text = sprintf(
        /* translators: number of megabytes */
        __('%s MB Space Allowed'),
        number_format_i18n($quota)
    );
    printf('<a href="%1$s" title="%2$s">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
    ?>
		</li><li class="storage-count <?php 
    echo $used_class;
    ?>">
			<?php 
    $text = sprintf(
        /* translators: 1: number of megabytes, 2: percentage */
        __('%1$s MB (%2$s%%) Space Used'),
        number_format_i18n($used, 2),
        $percentused
    );
    printf('<a href="%1$s" title="%2$s" class="musublink">%3$s</a>', esc_url(admin_url('upload.php')), __('Manage Uploads'), $text);
    ?>
		</li>
	</ul>
	</div>
	<?php 
}

WordPress Version: 3.7

/**
 * Display file upload quota on dashboard.
 *
 * Runs on the activity_box_end hook in wp_dashboard_right_now().
 *
 * @since 3.0.0
 *
 * @return bool True if not multisite, user can't upload files, or the space check option is disabled.
*/
function wp_dashboard_quota()
{
    if (!is_multisite() || !current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) {
        return true;
    }
    $quota = get_space_allowed();
    $used = get_space_used();
    if ($used > $quota) {
        $percentused = '100';
    } else {
        $percentused = $used / $quota * 100;
    }
    $used_color = ($percentused >= 70) ? ' spam' : '';
    $used = round($used, 2);
    $percentused = number_format($percentused);
    ?>
	<p class="sub musub"><?php 
    _e('Storage Space');
    ?></p>
	<div class="table table_content musubtable">
	<table>
		<tr class="first">
			<td class="first b b-posts"><?php 
    printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>'), esc_url(admin_url('upload.php')), number_format_i18n($quota));
    ?></td>
			<td class="t posts"><?php 
    _e('Space Allowed');
    ?></td>
		</tr>
	</table>
	</div>
	<div class="table table_discussion musubtable">
	<table>
		<tr class="first">
			<td class="b b-comments"><?php 
    printf(__('<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>'), esc_url(admin_url('upload.php')), number_format_i18n($used, 2), $percentused);
    ?></td>
			<td class="last t comments<?php 
    echo $used_color;
    ?>"><?php 
    _e('Space Used');
    ?></td>
		</tr>
	</table>
	</div>
	<br class="clear" />
	<?php 
}