Core Function
View Source on Trac ↗ wp_img_tag_add_srcset_and_sizes_attr()
wp_img_tag_add_srcset_and_sizes_attr( mixed $image, mixed $context, mixed $attachment_id ) Adds `srcset` and `sizes` attributes to an existing `img` HTML tag.
Parameters 3 required
| Name / Type | Description |
|---|---|
| $image string | The HTML `img` tag where the attribute should be added. Required |
| $context string | Additional context to pass to the filters. Required |
| $attachment_id int | Image attachment ID. Required |
Return Value
(string)
Converted 'img' element with 'loading' attribute added.
Function Information
Since Version
5.5.0
Source File
wp-includes/media.php
Advertisement