wp_calculate_image_srcset_meta хук-фильтрWP 4.5.0

Pre-filters the image meta to be able to fix inconsistencies in the stored data.

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

add_filter( 'wp_calculate_image_srcset_meta', 'wp_kama_calculate_image_srcset_meta_filter', 10, 4 );

/**
 * Function for `wp_calculate_image_srcset_meta` filter-hook.
 * 
 * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
 * @param int[]  $size_array    An array of requested width and height values.
 * @param string $image_src     The 'src' of the image.
 * @param int    $attachment_id The image attachment ID or 0 if not supplied.
 *
 * @return array
 */
function wp_kama_calculate_image_srcset_meta_filter( $image_meta, $size_array, $image_src, $attachment_id ){

	// filter...
	return $image_meta;
}
$image_meta(массив)
The image meta data as returned by 'wp_get_attachment_metadata()'.
$size_array(int[])

An array of requested width and height values.

  • 0(int)
    The width in pixels.

  • 1(int)
    The height in pixels.
$image_src(строка)
The 'src' of the image.
$attachment_id(int)
The image attachment ID or 0 if not supplied.

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

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

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

wp_calculate_image_srcset()
wp_calculate_image_srcset_meta
wp-includes/media.php 1318
$image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id );

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

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