The code I'm currently using in my wordpress functions file is this:
function remove_width_attribute( $html ) {
$html = preg_replace( '/(width|height)=("|\')\d*(|px)("|\')\s/', "", $html );
return $html;
}
add_filter( 'the_content', 'remove_width_attribute', 10 );
The problem here is that it targets iframes too, so how would I rewrite the regex to say images only?