apply_filters( 'wp_calculate_image_srcset_meta', array $image_meta, int[] $size_array, string $image_src, int $attachment_id )
- Since
- 4.5.0
Pre-filters the image meta to be able to fix inconsistencies in the stored data.
Compatibility
- WordPress
- since 4.5.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
$image_metaarray- The image meta data as returned by 'wp_get_attachment_metadata()'.
$size_arrayint[]- { An array of requested 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.
$image_srcstring- The 'src' of the image.
$attachment_idint- The image attachment ID or 0 if not supplied.
Where this hook fires · 1
wp-includes/media.php:1345wp_calculate_image_srcset()
Source code
* @type int $0 The width in pixels. * @type int $1 The height in pixels. * } * @param string $image_src The 'src' of the image. * @param int $attachment_id The image attachment ID or 0 if not supplied. */ $image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id ); if ( empty( $image_meta['sizes'] ) || ! isset( $image_meta['file'] ) || strlen( $image_meta['file'] ) < 4 ) { return false; } $image_sizes = $image_meta['sizes'];Changelog
Introduced in 4.5.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.8.8 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.