Remove the Width and Height Added to WordPress Images

Posted on 17th September, 2015 374 Comments

When you’re making a site responsive you don’t want images to have a set width and height, so to remove these from your them you will…

Add this to your functions.php

/*
 * REMOVE WIDTH AND HEIGHT ON IMAGES
 *************************************************************/
add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );

function remove_width_attribute( $html ) {
   $html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
   return $html;
}

Comments

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]

JamesVen

21st, Oct, 20

to concussive entente that, postinjury pathophysiology, and narrow of treatment. [url=https://ciamedusa.com/#]cheap cialis uk online[/url] rare table in sizeable burns, which can emerge rapidly and.

JamesVen

21st, Oct, 20

Szmaac zlxpju online buy cialis generic tadalafil [url=https://ciamedusa.com/]cialis online prescription[/url] of Pyridoxine’s canada drugs online survey deficiency is Ш° ر—cialis online.

RobertBAR

31st, Oct, 20

erectile restoration centers llc [url=http://erectiledysfunctionpillscvs.com/#]erectile dysfunction pills[/url] reviews of erectile dysfunction treatment

RobertBAR

05th, Nov, 20

will erectile dysfunction go away [url=http://erectiledysfunctionpillscvs.com/#]erectile dysfunction remedies[/url] erectile reverser

Stevewah

08th, Nov, 20

[url=https://sittindonesia.org/d6967fe9748d6dc60a6682f497bcfd1c/book/1603776879-9783842300538]Das Beziehungs-Mandala[/url]

[url=https://serpillo.it/fc96fad52c0d859b1f88f6622317530d/magazine/superbike-italia-dicembre-2016]Superbike Italia – Dicembre 2016]

[url=https://mayxaydungsg.com/en/b2f7242ec1e43289269a9e92c73be0ae/stream/61890-1602555912/2015]Hyde, Jekyll, Me[/url]

[url=https://alufiero.it/en/f4e82d07710d7fc5bb4b7ba00308a0ae/stream/10577-1603626343/2000]Dracula 2000]

free porn videos

24th, Nov, 20

I’m amazed, I have to admit. Rarely do I encounter a blog that’s equally educative and entertaining, and without a doubt, you have hit the nail on the head.

The issue is something that too few people are speaking intelligently about.
Now i’m very happy I came across this during my search for something relating to this.

AngeloTef

03rd, Dec, 20

viagra over the counter usa 2020 viagra canadian online pharmacy viagra

basics electrical contractors san diego

04th, Dec, 20

I in addition to my buddies were actually going through the excellent things located on the website then then I got a horrible feeling I had not expressed respect to you for those tips. All of the young men ended up absolutely excited to see them and have actually been making the most of them. I appreciate you for being really kind as well as for having certain incredibly good subject areas millions of individuals are really desirous to learn about. My honest regret for not expressing gratitude to you sooner.

hey

22nd, Dec, 20

Taxi moto line
128 Rue la Boétie
75008 Paris
+33 6 51 612 712  

Taxi moto paris

hello!,I like your writing so so much! percentage we
keep up a correspondence more approximately your article on AOL?
I require a specialist on this house to resolve my problem.
Maybe that’s you! Having a look forward to peer you.

Mandi Kizzia

03rd, Jan, 21

Wonderful beat ! I would like to apprentice while you amend your website, how can i subscribe for a blog site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear idea|

vreyrolinomit

05th, Jan, 21

Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a bit, but other than that, this is fantastic blog. An excellent read. I’ll definitely be back.

vreyrolinomit

10th, Jan, 21

Good day! This is my 1st comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading your articles. Can you recommend any other blogs/websites/forums that deal with the same subjects? Thanks a ton!

zortilonrel

15th, Jan, 21

Great work! This is the type of information that are meant to be shared across the web. Disgrace on the seek engines for now not positioning this submit higher! Come on over and talk over with my web site . Thank you =)

Jamesstaro

19th, Jan, 21

free cialis medication for providers buy cialis zolktjuh cialis coupon code
cialis tadalafil 20 mg

vreyrolinomit

20th, Jan, 21

Good write-up, I’m normal visitor of one’s website, maintain up the excellent operate, and It is going to be a regular visitor for a lengthy time.

windows activator kmsauto

20th, Jan, 21

Hello! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me. Anyhow, I’m definitely happy I found it and I’ll be bookmarking and checking back often!|

Fmnfeloks

31st, Jan, 21

cialis black 800 mg pill house cialis 10mg viagra and cialis [url=https://impotencecdny.com/info/history.php]is it legal to buy cialis online?[/url] ’

cheap flights

31st, Jan, 21

My spouse and I stumbled over here by a different website and thought I might
check things out. I like what I see so now i’m following you.

Look forward to exploring your web page again.

vreyro linomit

31st, Jan, 21

I do not even know how I ended up here, but I thought this post was great. I do not know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

cheap flights

01st, Feb, 21

Thank you for any other excellent article. Where else may anyone get that type of
information in such an ideal approach of
writing? I’ve a presentation next week, and I’m at the search for such information.

KbbgBoth

01st, Feb, 21

over the counter viagra viagra Trimox viagra and viagra [url=http://erectilejyzd.com/]pharmacy online drugstore[/url] ’

tinyurl.com

02nd, Feb, 21

Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is valuable and all. Nevertheless just imagine if you added some great
photos or videos to give your posts more, “pop”! Your content is excellent but with images and video clips, this site could undeniably be
one of the greatest in its niche. Great blog!

cheap flights

02nd, Feb, 21

Hi there colleagues, fastidious article and good arguments commented here, I am genuinely enjoying by these.

tinyurl.com

03rd, Feb, 21

Oh my goodness! Impressive article dude! Thanks, However I am going through problems with your RSS.
I don’t know the reason why I cannot join it. Is there anybody having the same RSS issues?
Anyone who knows the solution will you kindly respond? Thanx!!

zortilonrel

07th, Feb, 21

I’ve been surfing on-line greater than three hours lately, yet I never discovered any attention-grabbing article like yours. It is beautiful price sufficient for me. In my view, if all web owners and bloggers made excellent content as you probably did, the web will probably be much more helpful than ever before.

http://tinyurl.com

12th, Feb, 21

I must thank you for the efforts you have put in penning this
website. I’m hoping to see the same high-grade blog posts from you later on as well.
In truth, your creative writing abilities
has inspired me to get my own, personal site now 😉

Ybacroli

13th, Feb, 21

health insurance carriers – viagra generic Adunjsq
cialis generico senza ricetta in farmacia
most common age viagra: [url=https://www.withoutbro.com/]viagra without a prescription[/url]

Thao Behrenwald

14th, Apr, 21

I’ve learned newer and more effective things through the blog post. Yet another thing to I have seen is that generally, FSBO sellers are going to reject an individual. Remember, they will prefer not to ever use your services. But if a person maintain a stable, professional relationship, offering assistance and keeping contact for about four to five weeks, you will usually be able to win a business interview. From there, a listing follows. Thanks

Leave a Comment

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]