Filter hook 'wp_filesize'

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

View Source

wp_filesize

Filter Hook
Description
Filters the size of the file.

Hook Information

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

Hook Parameters

Type Name Description
int $size The result of PHP filesize on the file.
string $path Path to the file.

Usage Examples

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

function my_custom_filter($size, $path) {
    // Your custom filtering logic here
    return $size;
}

Source Code Context

wp-includes/functions.php:3628 - How this hook is used in WordPress core
<?php
3623  	 * @since 6.0.0
3624  	 *
3625  	 * @param int    $size The result of PHP filesize on the file.
3626  	 * @param string $path Path to the file.
3627  	 */
3628  	return (int) apply_filters( 'wp_filesize', $size, $path );
3629  }
3630  
3631  /**
3632   * Retrieves the list of allowed mime types and file extensions.
3633   *

PHP Documentation

<?php
/**
	 * Filters the size of the file.
	 *
	 * @since 6.0.0
	 *
	 * @param int    $size The result of PHP filesize on the file.
	 * @param string $path Path to the file.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.