get_image_tag
Filters the HTML content for the image tag.
Использование
add_filter( 'get_image_tag', 'wp_kama_get_image_tag_filter', 10, 6 ); /** * Function for `get_image_tag` filter-hook. * * @param string $html HTML content for the image. * @param int $id Attachment ID. * @param string $alt Image description for the alt attribute. * @param string $title Image description for the title attribute. * @param string $align Part of the class name for aligning the 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 string */ function wp_kama_get_image_tag_filter( $html, $id, $alt, $title, $align, $size ){ // filter... return $html; }
- $html(строка)
- HTML content for the image.
- $id(int)
- Attachment ID.
- $alt(строка)
- Image description for the alt attribute.
- $title(строка)
- Image description for the title attribute.
- $align(строка)
- Part of the class name for aligning the 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.6.0 | Введена. |
Где вызывается хук
get_image_tag
wp-includes/media.php 421
return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );