apply_filters( ‘pre_wp_filesize’, null|int $size, string $path )

In this article

Filters the result of wp_filesize() before the file_exists() PHP function is run.

Parameters

$sizenull|int
The unfiltered value. Returning a non-negative number from the callback bypasses the filesize call.
$pathstring
Path to the file.

Source

$size = apply_filters( 'pre_wp_filesize', null, $path );

Changelog

VersionDescription
7.1.0Negative values are now ignored, being treated the same as null. Numeric values are cast to integers.
6.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.