Removing width and height attributes from
-
I don’t remember where I found this. It works for me, almost…
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); function remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; }
But, when I add a caption to an image it does not work. The height/width attributes gets added to <img>.
Suggestions?
- The topic ‘Removing width and height attributes from’ is closed to new replies.