Remove width/ height from inserted images

To allow for responsiveness, it’s best to remove the width/ height tags that are added by default.

Add this to your functions.php to remove them:

add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );

function remove_width_attribute( $html ) {
   $html = preg_replace( '/(width|height)="d*"s/', "", $html );
   return $html;
}