Remove height & width attributes from images In WordPress posts

Simply add this scrap to the functions.php of your wordpress subject and the majority of the width and tallness characteristics will be expelled from your pictures.

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;
}

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *