1

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.

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

migrated from stackoverflow.com Dec 20 '12 at 17:24

This question came from our site for professional and enthusiast programmers.

  • this was originally a cross-post, after migration now a dupe of this question – Milo Dec 20 '12 at 17:36
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' => ''));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.