id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 30525,Add width and height parameters to 'wp_get_attachment_image_attributes' filter,hereswhatidid,,"Currently, in order to display an attachment image without width and height attributes you must do something like this: {{{ $image = wp_get_attachment_image_src( $attachment_id, 'my-image-size' ); $alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ); echo ''; }}} This feels very clumsy and it only works on a call by call basis. To remove it via filters requires a regex to manipulate the full IMG tag as a string. What this patch does is add 'width' and 'height' attributes to the $default_attr array within the wp_get_attachment_image function so that they can be directly modified via the 'wp_get_attachment_image_attributes' filter. This makes it very easy to remove or modify the width and height attributes without any regex knowledge. Here's an example with the new version that would remove all width and height attributes to any attachment images: {{{ function remove_image_dimensions( $attr ) { unset( $attr['width'] ); unset( $attr['height'] ); return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'remove_image_dimensions', 10 ); }}}",enhancement,closed,normal,,Media,4.1,normal,duplicate,,,template