get_space_used

Returns the space used by the current blog.

Description

(int) get_space_used(); 

Returns (int)

Used space in megabytes


Usage

  1. if ( !function_exists( 'get_space_used' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_space_used(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-functions.php  
  1. function get_space_used() { 
  2. /** 
  3. * Filters the amount of storage space used by the current site. 
  4. * @since 3.5.0 
  5. * @param int|bool $space_used The amount of used space, in megabytes. Default false. 
  6. */ 
  7. $space_used = apply_filters( 'pre_get_space_used', false ); 
  8. if ( false === $space_used ) { 
  9. $upload_dir = wp_upload_dir(); 
  10. $space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES
  11.  
  12. return $space_used;