wp_image_src_get_dimensions
Filters the wp_image_src_get_dimensions
Usage
add_filter( 'wp_image_src_get_dimensions', 'wp_kama_image_src_get_dimensions_filter', 10, 4 );
/**
* Function for `wp_image_src_get_dimensions` filter-hook.
*
* @param array|false $dimensions Array with first element being the width and second element being the height, or false if dimensions could not be determined.
* @param string $image_src The image source file.
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
* @param int $attachment_id The image attachment ID.
*
* @return array|false
*/
function wp_kama_image_src_get_dimensions_filter( $dimensions, $image_src, $image_meta, $attachment_id ){
// filter...
return $dimensions;
}
- $dimensions(array|false)
- Array with first element being the width and second element being the height, or false if dimensions could not be determined.
- $image_src(string)
- The image source file.
- $image_meta(array)
- The image meta data as returned by 'wp_get_attachment_metadata()'.
- $attachment_id(int)
- The image attachment ID.
Changelog
| Since 5.7.0 | Introduced. |
Where the hook is called
wp_image_src_get_dimensions
wp-includes/media.php 1757
return apply_filters( 'wp_image_src_get_dimensions', $dimensions, $image_src, $image_meta, $attachment_id );