Loading
Loading....

Wordpress Stripping out your line break?

I had to deal with the issue several hours today of Wordpress stripping out any line break code I tried. I assume it’s some sort of bug, although it seems to be happen with all versions of wordpress. It seems to happen after you left-align a picture. Anyway, I read multiple blogs and none of them seemed to offer a solution that actually worked, usually Wordpress just immediately strips out the code when you switch to visual mode. Didn’t seem like there was anyway to force a line break or make Wordpress stop stripping it out. Anyway, after messing with it for several hours I found a simple solution, just click over to the “HTML” tab and put this code where you want your line break:

<br class="blank" />

That should do the trick. Has worked so far in every version of Wordpress I’ve tried.

32 Comments

THANK YOU.

words cannot express how much thank you i feel right now. ha. i’ve been tearing my hair out for a week about this. you’re my hero of the day. seriously.

Thank you SO much! Countless hours of sifting through plugins and CSS hacks but nothing works. Sometimes all you want is a quick line break after something and you have made that possible now!

THANK YOU VERY MUCH!!!

I have my blog full of lonely “.” trying to emulate a line break.

Thanks, Andrew! I was getting frustrated…

Thanks, but it is so ridiculous we even need to do this. I’m considering moving my blog elsewhere.

This has been bugging me for a long time. Finally today I decided to spend some time looking for a solution and found your posting. Thank you so much – this is a life saver!

Brilliant! Thanks a lot for the work and the solution.

WOW! simple as not aligning the image left. Who would have thought of that…Thanks for the tip.

Actually works too, and it is easier to type.

Actually [code][/code] works too and it is easier to type.

Bah, it won’t let me enter it.

Thanks for the Christmas present which I finally found in the Wordpress Forums after hours of frustration. Why, why, why don’t such elemental html tags as or work on the world’s most widely used scripting software????????????

Sorry, I forgot. It stripped out my cosde. I was referring, of course, to paragraph and line breaks. Geeez, they won’t even let me mention them in print.

i want you to have my babies now!!!

THANK YOU>
I have been searching for this for far too long, and stumbled on it today through the wordpress forums. THANK YOU for posting this, and posting on that forum!

Is there a way to actually REMOVE a line break? Wordpress seems to add a line break between my images automatically.

@G

What is your blog? Can you show me an example?

And another big thank you, Andrew!

You are my saviour

Thank you for this snippet of code. As someone very familiar with HTML and CSS I was considering upgrading to modify the CSS just to add heading padding but this will do for the time being.

Thank God.

If only Wordpress would actually fix the problem. Seems like a really stupid bug to leave in the code forever.

Andrew,

Thank you so much for this!

This blog post helped me tremendously, because with my anal-retentive nature (I’m a Virgo…not my fault), not being able to put in proper spacing was starting to piss me off.

Again, thank you for this!

Boy this absolutely saved me. I was getting tired of fixing line breaks daily. It is very frustrating and I do not know why Wordpress developers do not address this. It makes the job of blogging so tedious.

Anyway thanks a lot!

THANK YOU!!!!! This was an extremely welcomed fix to the WP issue. I was fighting this for a few hours for a client and was about to give up.

I, too, have been struggling with this disappearing line break issue. Thanks very much for the code. I hope it works. I see from my research that this problem has been a frustrating issue for several years now. I don’t understand why it’s still a problem and hasn’t been fixed in newer versions of Wordpress.

Great post.

Another way to force a line break in a wordpress post is to use a paragraph tag with a blank space in it as explained here:

http://www.theblogaholic.com/2011/01/16/add-line-breaks-in-wordpress-posts/

PHEW! Been looking EVERYWHERE for this!
Works like a charm.
THANKS!!!

Thank you thank you thank you. This has been bugging me all morning.

Thank You for sharing this useful tip. Nice Blog Nice Work. Keep it up.

ditto ditto ditto the thanks expressed! Great marketing move to do this. Shows your business in a very good light.

Trying to make…

a line break without those codes!

Leave a Comment