DAK: How to manually insert a <br /> into a post's code, and NOT have wordpress remove it?
This problem has been annoying me for AGES! I've tried alternative Text editor replacement plugins, but those usually added other formatting errors that made my posts worse. All I want is a way to add a <br /> and make it STAY PUT without WP stripping them out of my posts. Anyone know the best way to do this?
EDIT: I want to add more than one <br />, so a SECOND break, right in a row to add additional spacing in my blog.
Edited 7 Oct 2010. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 10 · 100% up
- Kind
- Text
- ID
- doadv
22 comments
I use a plugin called TinyMCE advanced. It adds some more functions to the editor and has an option to keep breaks.
I tried TinyMCE (and other editors) but they caused other issues at the time. I'm hoping to still use the built-in editor, thanks though.
If you know php (and wordpress) and you only need to keep the br tags, it wouldn't be too hard to write a hook to your theme's function.php.
Try wordpress stack excange or the wordpress.org forums, it won't be hard for someone familiar with the inner workings of wp.
Me to. It's pretty annoying WP deletes them.
I'm assuming you're concerned with getting a line break instead of a paragraph break, and not the specific insertion of your <br />.
If that's the case, just type/paste that content into HTML view. When you go back to Visual editing the spacing you put in code view will stay. This is by far the easiest solution I know to what I think of as the poetry problem.
As to manually inserting <br />s, I have no real experience, but HTML view usually seems to maintain formatting pretty well for me.
Yes, a line break. I've tried editing the content in both HTML and Visual modes, and any extra line breaks will be removed by Wordpress without fail, if there is more than 1 break consecutively.
Oh, so you're trying to do more than one linebreak at once. I could believe that WordPress's parser just tears that to bits.
Have you tried Windows Live Writer? The new version works perfectly with Wordpress (even self-hosted) and is more robust and faster than the visual editor in WP.
I haven't tried Live Writer with Wordpress, but I'll check it out!
I'd be interested in Live Writer but their website is god awful and gives no useful information whatsoever.
In your user options, you can simply turn off the visual editor. I think there's an option in there to not correct what it's calling malformed tags.
See, I want to use the visual editor, I just want an extra line break when I tell it to add one, without it taking the extra break out.
Try adding a bunch of these... <br />
I could have sworn WP removed the <br />'s the last time I tried adding anything after it... but I'll try this again.
I agree this is super , super annoying.
One of the tricks that seems to work even though it's kind of dumb is entering <code> </code>
I haven't tried that one, I'll try it next time.
I don't understand.
One of WP's core filters called
wpautopshould do this autoamtically. You shouldn't need to manually add line break or paragraph tags.In WP's non-visual editor,
wpautopadds a paragraph tag for every two line break characters (\n\n) and a break tag for a single line break character (\n).If you're putting a lot of HTML in your post/page content then you really ought to be using custom templates instead.