wp_get_attachment_image WordPress Filter Hook
The wp_get_attachment_image hook is used to retrieve the image for an attachment. This hook can be used with the 'ID' parameter to get the image for a specific attachment, or with the 'post_id' parameter to get the image for the first attachment for a post.
apply_filters( 'wp_get_attachment_image', string $html , int $attachment_id , string|int[] $size , bool $icon , string[] $attr ) #
HTML img element representing an image attachment.
Parameters
- $html
(string)HTML img element or empty string on failure.
- $attachment_id
(int)Image attachment ID.
- $size
(string|int[])Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
- $icon
(bool)Whether the image should be treated as an icon.
- $attr
(string[])Array of attribute values for the image markup, keyed by attribute name. See wp_get_attachment_image().
Source
File: wp-includes/media.php
Changelog
Version | Description |
---|---|
5.6.0 | Introduced. |