How to Remove width & height attributes from images in posts
Looking to remove the width and height attributes from images in your posts? Is this because you are using a responsive wordpress theme. Just add this snippet to the functions.php of your wordpress theme and all of the width and height attributes will be removed from your images.
add_filter( 'post_thumbnail_html', 'remove_wps_width_attribute', 10 ); add_filter( 'image_send_to_editor', 'remove_wps_width_attribute', 10 ); function remove_wps_width_attribute( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; }