WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/get space used"

m (Changelog: Link version 3.5)
(added info about pre_get_space_used filter)
Line 7: Line 7:
   
 
== Parameters ==
 
== Parameters ==
  +
  +
== Return Value ==
  +
; (integer) : Used space in megabytes
   
 
== Examples ==
 
== Examples ==
Line 22: Line 25:
 
?>
 
?>
 
%%%
 
%%%
  +
  +
== Filters ==
  +
* <tt>'pre_get_space_used'</tt> can be used to provide an alternative way of tracking storage space used. Returning <tt>false</tt> for this filter will revert to default behavior (megabytes used in [[Function_Reference/wp_upload_dir|wp_upload_dir()]] location).
   
 
== Change Log ==
 
== Change Log ==

Revision as of 19:05, 17 December 2012

Description

Returns the space used by the current blog.

Usage

 <?php $used get_space_used()  ?> 

Parameters

Return Value

(integer) 
Used space in megabytes

Examples

Default Usage

 
<?php
    $quota 
get_space_allowed();
    
$used get_space_used();

    if ( 
$used $quota ){
       
// do something they have used more than quota
    
}
?>
 

Filters

  • 'pre_get_space_used' can be used to provide an alternative way of tracking storage space used. Returning false for this filter will revert to default behavior (megabytes used in wp_upload_dir() location).

Change Log

Source File

get_space_used is located in wp-includes/ms-functions.php

Related