Filters the “BIG image” threshold value.
Description
If the original image width or height is above the threshold, it will be scaled down. The threshold is used as max width and max height. The scaled down image will be used as the largest available size, including the _wp_attached_file post meta value.
Returning false from the filter callback will disable the scaling.
Parameters
$thresholdint- The threshold value in pixels. Default 2560.
$imagesizearray- Indexed array of the image width and height in pixels.
0intThe image width.1intThe image height.
$filestring- Full path to the uploaded image file.
$attachment_idint- Attachment post ID.
Source
$threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id );
Changelog
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |
Usage examples:
__return_falseis a function name, andadd_filter()is a function that expects a callable (in this case, a function name) for the second parameter, so it is correct to provide__return_falseas a string.// Do not scale (large) PNG images. // May result in sub-sizes that have greater file size than the original. if ('image/png' !== $imagesize['mime']) { /* filter applied here */ }// as of 2025, I had to specify lower priority for return false version to work
add_filter( 'big_image_size_threshold', '__return_false', 100, 1 );