WordPress at a glance
filter is not described

wp_img_tag_add_width_and_height_attr filter-hook . WP 5.5.0

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

Returning anything else than true will not add the attributes.


add_filter( 'wp_img_tag_add_width_and_height_attr', 'filter_function_name_6497', 10, 4 );
function filter_function_name_6497( $value, $image, $context, $attachment_id ){
	// filter...

	return $value;
The filtered value.
Default: true
The HTML img tag where the attribute should be added.
Additional context about how the function was called or where the img tag is.
The image attachment ID.

Список изменений

С версии 5.5.0 Введена.

Где вызывается хук

wp-includes/media.php 1873
$add = apply_filters( 'wp_img_tag_add_width_and_height_attr', true, $image, $context, $attachment_id );

Где используется хук в ядре WP

Использование не найдено.