返回当前博客使用的空间。

原型

get_space_used()

返回值

(int)  已用空间(兆字节)

源文件

路径:wp-includes/ms-functions.php

<?php
...
function get_space_used() {
	/**
	 * Filters the amount of storage space used by the current site.
	 *
	 * @since 3.5.0
	 *
	 * @param int|bool $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;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/get_space_used/