image_downsize хук-фильтрWP 2.5.0

Filters whether to preempt the output of image_downsize().

Returning a truthy value from the filter will effectively short-circuit down-sizing the image, returning that value instead.

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

add_filter( 'image_downsize', 'wp_kama_image_downsize_filter', 10, 3 );

/**
 * Function for `image_downsize` filter-hook.
 * 
 * @param bool|array   $downsize Whether to short-circuit the image downsize.
 * @param int          $id       Attachment ID for image.
 * @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).
 *
 * @return bool|array
 */
function wp_kama_image_downsize_filter( $downsize, $id, $size ){

	// filter...
	return $downsize;
}
$downsize(true|false|массив)
Whether to short-circuit the image downsize.
$id(int)
Attachment ID for image.
$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).

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

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

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

image_downsize()
image_downsize
wp_prepare_attachment_for_js()
image_downsize
wp-includes/media.php 207
$out = apply_filters( 'image_downsize', false, $id, $size );
wp-includes/media.php 4434
$downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size );

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

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