Filter hook 'pre_wp_filesize'

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

View Source

pre_wp_filesize

Filter Hook
Description
Filters the result of wp_filesize before the PHP function is run.

Hook Information

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

Hook Parameters

Type Name Description
null|int $size The unfiltered value. Returning an int from the callback bypasses the filesize call.
string $path Path to the file.

Usage Examples

Basic Usage
<?php
// Hook into pre_wp_filesize
add_filter('pre_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:3612 - How this hook is used in WordPress core
<?php
3607  	 * @since 6.0.0
3608  	 *
3609  	 * @param null|int $size The unfiltered value. Returning an int from the callback bypasses the filesize call.
3610  	 * @param string   $path Path to the file.
3611  	 */
3612  	$size = apply_filters( 'pre_wp_filesize', null, $path );
3613  
3614  	if ( is_int( $size ) ) {
3615  		return $size;
3616  	}
3617  

PHP Documentation

<?php
/**
	 * Filters the result of wp_filesize before the PHP function is run.
	 *
	 * @since 6.0.0
	 *
	 * @param null|int $size The unfiltered value. Returning an int from the callback bypasses the filesize call.
	 * @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.