Retrieves width and height attributes using given width and height values.
Description
Both attributes are required in the sense that both parameters must have a value, but are optional in that if you set them to false or null, then they will not be added to the returned string. You can set the value using a string, but it will only take numeric values.If you wish to put 'px' after the numbers, then it will be stripped out of the return.
Parameters
$widthint|string
Image width in pixels.
$heightint|string
Image height in pixels.
Return
string
HTML attributes for width and, or height.
Used by · 3
get_image_tag()Gets an img tag for an image attachment, scaling it down if requested.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/media.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.