get_space_used()WP 3.5.0

Returns the space used by the current site.

Hooks from the function

Return

Int. Used space in megabytes.

Usage

get_space_used();

Changelog

Since 3.5.0 Introduced.

get_space_used() code WP 6.6.2

function get_space_used() {
	/**
	 * Filters the amount of storage space used by the current site, in megabytes.
	 *
	 * @since 3.5.0
	 *
	 * @param int|false $space_used The amount of used space, in megabytes. Default false.
	 */
	$space_used = apply_filters( 'pre_get_space_used', false );

	if ( false === $space_used ) {
		$upload_dir = wp_upload_dir();
		$space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES;
	}

	return $space_used;
}