Can’t remove WordPress post image height/width attributes?

I know a few people have asked this question previously; however, I think something may have changed recently in the WordPress update.

I’m building my own responsive theme for my portfolio, and for embedded post images I have added a filter to functions.php to remove the height/width attribute that WordPress adds to the image automatically. I have used this filter before on other sites therefore I know it should work.

Read More

However, no matter what I try I can’t get WordPress to embed the image without the height/width attributes, meaning the image doesn’t resize on mobiles/tablets.

Demo for the image in question is here:

http://demo.iamdannygreen.com/cients/dragonfly-pr/

Any help would be greatly appreciated.

Thanks

Danny

Related posts

Leave a Reply

1 comment

  1. Is this through the post thumbnail functions, or TinyMCE?

    If it’s through the post thumbnail, you should be able to blank out those attributes like this:

    the_post_thumbnail('thumbnail', array('height' => '', 'width' => ''));