big_image_size_threshold
Filter HookDescription
Filters the "BIG image" threshold value. 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. }Hook Information
File Location |
wp-admin/includes/image.php
View on GitHub
|
Hook Type | Filter |
Line Number | 285 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$threshold
|
The threshold value in pixels. Default 2560. |
array
|
$imagesize
|
{ Indexed array of the image width and height in pixels. |
string
|
$file
|
Full path to the uploaded image file. |
int
|
$attachment_id
|
Attachment post ID. |
Usage Examples
Basic Usage
<?php
// Hook into big_image_size_threshold
add_filter('big_image_size_threshold', 'my_custom_filter', 10, 4);
function my_custom_filter($threshold, $imagesize, $file, $attachment_id) {
// Your custom filtering logic here
return $threshold;
}
Source Code Context
wp-admin/includes/image.php:285
- How this hook is used in WordPress core
<?php
280 * @type int $1 The image height.
281 * }
282 * @param string $file Full path to the uploaded image file.
283 * @param int $attachment_id Attachment post ID.
284 */
285 $threshold = (int) apply_filters( 'big_image_size_threshold', 2560, $imagesize, $file, $attachment_id );
286
287 /*
288 * If the original image's dimensions are over the threshold,
289 * scale the image and use it as the "full" size.
290 */
PHP Documentation
<?php
/**
* Filters the "BIG image" threshold value.
*
* 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.
*
* @since 5.3.0
*
* @param int $threshold The threshold value in pixels. Default 2560.
* @param array $imagesize {
* Indexed array of the image width and height in pixels.
*
* @type int $0 The image width.
* @type int $1 The image height.
* }
* @param string $file Full path to the uploaded image file.
* @param int $attachment_id Attachment post ID.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-admin/includes/image.php
Related Hooks
Related hooks will be displayed here in future updates.