wp_image_src_get_dimensions хук-фильтрWP 5.7.0

Filters the wp_image_src_get_dimensions

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

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(массив|false)
Array with first element being the width and second element being the height, or false if dimensions could not be determined.
$image_src(строка)
The image source file.
$image_meta(массив)
The image meta data as returned by 'wp_get_attachment_metadata()'.
$attachment_id(int)
The image attachment ID.

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

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

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

wp_image_src_get_dimensions()
wp_image_src_get_dimensions
wp-includes/media.php 1703
return apply_filters( 'wp_image_src_get_dimensions', $dimensions, $image_src, $image_meta, $attachment_id );

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

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