get_image_tag
Filter HookDescription
Filters the HTML content for the image tag.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 426 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$html
|
HTML content for the image. |
int
|
$id
|
Attachment ID. |
string
|
$alt
|
Image description for the alt attribute. |
string
|
$title
|
Image description for the title attribute. |
string
|
$align
|
Part of the class name for aligning the image. |
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). |
Usage Examples
Basic Usage
<?php
// Hook into get_image_tag
add_filter('get_image_tag', 'my_custom_filter', 10, 6);
function my_custom_filter($html, $id, $alt, $title, $align, $size) {
// Your custom filtering logic here
return $html;
}
Source Code Context
wp-includes/media.php:426
- How this hook is used in WordPress core
<?php
421 * @param string $title Image description for the title attribute.
422 * @param string $align Part of the class name for aligning the image.
423 * @param string|int[] $size Requested image size. Can be any registered image size name, or
424 * an array of width and height values in pixels (in that order).
425 */
426 return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
427 }
428
429 /**
430 * Calculates the new dimensions for a down-sampled image.
431 *
PHP Documentation
<?php
/**
* Filters the HTML content for the image tag.
*
* @since 2.6.0
*
* @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).
*/
Quick Info
- Hook Type: Filter
- Parameters: 6
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.