apply_filters( 'wp_constrain_dimensions', int[] $dimensions, int $current_width, int $current_height, int $max_width, int $max_height )
- Since
- 4.1.0
Filters dimensions to constrain down-sampled images to.
Compatibility
- WordPress
- since 4.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$dimensionsint[]- { An array of width and height values.
@type int $0 The width in pixels.
@type int $1 The height in pixels.
}$0intThe width in pixels.$1intThe height in pixels.
$current_widthint- The current width of the image.
$current_heightint- The current height of the image.
$max_widthint- The maximum width permitted.
$max_heightint- The maximum height permitted.
Where this hook fires · 1
wp-includes/media.php:513wp_constrain_dimensions()
Source code
* } * @param int $current_width The current width of the image. * @param int $current_height The current height of the image. * @param int $max_width The maximum width permitted. * @param int $max_height The maximum height permitted. */ return apply_filters( 'wp_constrain_dimensions', array( $w, $h ), $current_width, $current_height, $max_width, $max_height );} /** * Retrieves calculated resize dimensions for use in WP_Image_Editor. * * Calculates dimensions and coordinates for a resized image that fitsChangelog
Introduced in 4.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.