
When you upload images via WordPress image uploader and insert it into your posts, WordPress automatically include the image width and height attributes in the html <img> tag. But when using a responsible theme, this can cause lots of trouble. Here’s a quick recipe to get rid of those attributes.






WPRecipes.com is hosted by VidaHost. Use our exclusive coupon CATSWHOCODE to get a 10% discount on hosting! 








5 Responses
Nice. Thanks for the tip!
if you wanted to remove the other variables too
$html = preg_replace(‘/(alt|title|class|width|height)=\”[^"]*”\s/’,”, trim($html));
But keep in mind that having these attributes helps for faster loading of the images. So don’t remove them if you have no problems or reasons
.
Interesting find, thanks for sharing.
@author thanks it will help me!
Trackbacks: