Title: wp_filesize
Published: May 25, 2022
Last modified: February 24, 2026

---

# apply_filters( ‘wp_filesize’, int $size, string $path )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#wp--skip-link--target)

Filters the size of the file.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#parameters)󠁿

 `$size`int

The result of PHP filesize on the file.

`$path`string

Path to the file.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#source)󠁿

    ```php
    return (int) apply_filters( 'wp_filesize', $size, $path );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/functions.php#L3636)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/functions.php#L3636-L3636)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_filesize()](https://developer.wordpress.org/reference/functions/wp_filesize/)`wp-includes/functions.php` |

Wrapper for PHP filesize with filters and casting the result as an integer.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_filesize/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_filesize%2F)
before being able to contribute a note or feedback.