apply_filters( 'wp_img_tag_add_width_and_height_attr', bool $value, string $image, string $context, int $attachment_id )

Filters whether to add the missing width and height HTML attributes to the img tag. Default true.

Description Description

Returning anything else than true will not add the attributes.

Top ↑

Parameters Parameters


(bool) The filtered value, defaults to true.


(string) The HTML img tag where the attribute should be added.


(string) Additional context about how the function was called or where the img tag is.


(int) The image attachment ID.

Top ↑

Source Source

File: wp-includes/media.php

View on Trac

Top ↑

Changelog Changelog

Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

Top ↑

You must log in before being able to contribute a note or feedback.