wp_calculate_image_sizes хук-фильтрWP 4.4.0

Filters the output of wp_calculate_image_sizes().

Использование

add_filter( 'wp_calculate_image_sizes', 'wp_kama_calculate_image_sizes_filter', 10, 5 );

/**
 * Function for `wp_calculate_image_sizes` filter-hook.
 * 
 * @param string       $sizes         A source size value for use in a 'sizes' attribute.
 * @param string|int[] $size          Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
 * @param string|null  $image_src     The URL to the image file or null.
 * @param array|null   $image_meta    The image meta data as returned by wp_get_attachment_metadata() or null.
 * @param int          $attachment_id Image attachment ID of the original image or 0.
 *
 * @return string
 */
function wp_kama_calculate_image_sizes_filter( $sizes, $size, $image_src, $image_meta, $attachment_id ){

	// filter...
	return $sizes;
}
$sizes(строка)
A source size value for use in a 'sizes' attribute.
$size(строка|int[])
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
$image_src(строка|null)
The URL to the image file or null.
$image_meta(массив|null)
The image meta data as returned by wp_get_attachment_metadata() or null.
$attachment_id(int)
Image attachment ID of the original image or 0.

Список изменений

С версии 4.4.0 Введена.

Где вызывается хук

wp_calculate_image_sizes()
wp_calculate_image_sizes
wp-includes/media.php 1524
return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );

Где используется хук в WordPress

Использование не найдено.