On this page
apply_filters( 'wp_get_attachment_image_attributes', string[] $attr, WP_Post $attachment, string|int[] $size )
Filters the list of attachment image attributes.
Parameters
$attrstring[]-
Array of attribute values for the image markup, keyed by attribute name.
See wp_get_attachment_image() .More Arguments from wp_get_attachment_image( ... $attr )
Attributes for the image markup.
srcstringImage attachment URL.classstringCSS class name or space-separated list of classes.
Defaultattachment-$size_class size-$size_class, where$size_classis the image size being requested.altstringImage description for the alt attribute.srcsetstringThe'srcset'attribute value.sizesstringThe'sizes'attribute value.loadingstring|falseThe'loading'attribute value. Passing a value of false will result in the attribute being omitted for the image.
Defaults to'lazy', depending on wp_lazy_loading_enabled() .decodingstringThe'decoding'attribute value. Possible values are'async'(default),'sync', or'auto'.
$attachmentWP_Post-
Image attachment post.
$sizestring|int[]-
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
Source
File: wp-includes/media.php. View all references
$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
Related
Used By
| Used By | Description |
|---|---|
| wp_get_attachment_image() wp-includes/media.php | Gets an HTML img element representing an image attachment. |
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_attributes