Filter hook 'pre_get_space_used'

in WP Core File wp-includes/ms-functions.php at line 2597

View Source

pre_get_space_used

Filter Hook
Description
Filters the amount of storage space used by the current site, in megabytes.

Hook Information

File Location wp-includes/ms-functions.php View on GitHub
Hook Type Filter
Line Number 2597

Hook Parameters

Type Name Description
int|false $space_used The amount of used space, in megabytes. Default false.

Usage Examples

Basic Usage
<?php
// Hook into pre_get_space_used
add_filter('pre_get_space_used', 'my_custom_filter', 10, 1);

function my_custom_filter($space_used) {
    // Your custom filtering logic here
    return $space_used;
}

Source Code Context

wp-includes/ms-functions.php:2597 - How this hook is used in WordPress core
<?php
2592  	 *
2593  	 * @since 3.5.0
2594  	 *
2595  	 * @param int|false $space_used The amount of used space, in megabytes. Default false.
2596  	 */
2597  	$space_used = apply_filters( 'pre_get_space_used', false );
2598  
2599  	if ( false === $space_used ) {
2600  		$upload_dir = wp_upload_dir();
2601  		$space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES;
2602  	}

PHP Documentation

<?php
/**
	 * 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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/ms-functions.php
Related Hooks

Related hooks will be displayed here in future updates.