WPDev.one
Core Function
View Source on Trac ↗

wp_img_tag_add_width_and_height_attr()

wp_img_tag_add_width_and_height_attr( mixed $image, mixed $context, mixed $attachment_id )

Adds `width` and `height` attributes to an `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 'width' and 'height' attributes added.

Function Information

Since Version
5.5.0
Source File
wp-includes/media.php
Advertisement