Support » Fixing WordPress » 2.8 HTML editor adding <p> and <br />

  • Ok, so I haven’t used the visual editor in so long that I don’t even remember what it looks like… So we know that’s not the issue.

    I ONLY use the HTML editor and I write my own <p> tags and <br /> and so forth… The problem I’m running into now after upgrading to 2.8 is that each time I use a special <span> with custom styling that I’ve made, WP is adding a <p> around that span as well as a <br /> after the paragraph.

    I’m also noticing that there are extra <br /> being added beneath images that I insert into the post…

    It’s completely screwing up the look of the post and it’s beginning to piss me off.

Viewing 13 replies - 1 through 13 (of 13 total)
  • esmi


    Forum Moderator

    <span> is an inline element (no matter how it’s styled) and should still be enclosed in a block level element such as <p> or <div>. So WP is actually acting correctly and in line with the relevant W3C specs. Try placing your span blocks inside unstyled div tags. That will stop the auto-addition of paragraph markup.

    As for the break tags after images, I’ve not noticed that myself and I use the HTML tab all of the time.

    I’m noticing that if I use an image in my posts/pages, WP is wrapping the image with a <p> tag and then adding a <br /> after the image…

    So instead of the markup looking like:

    <img src="blah.jpg" alt="" />

    It winds up coded like this:

    <img src="blah.jpg" alt="" />
    <br />

    That is ridiculous…

    Is there any further news on this? I’m suddenly noticing this same problem on a couple of websites that NEED to be 100% validated code. WP is messing up the validation completely by adding in code.

    Even weirder, the code isn’t even showing up in the editor, but will show up in the webpage output. Huh?!? I upgraded to 2.8.2 hoping it would fix this issue, but it didn’t. What gives? I too, never use the visual editor.

    I’m having this same issue. It makes it impossible to run google website optimizer tests. They require <script></script> and </noscript> blocks in the body and even with the visual editor and allow wordpress to correct XHTML settings disabled, they tags get wrapped in <p></p>




    Forum Moderator

    Enclose the <script></script> and </noscript> blocks inside `<div></div>’ tags.

    I found a solution by using the following plugin:

    Hope it helps you guys as well…

    Very annoyed with this! Fix this s**t how hard is it to not add html? Is there a plain editor option? aka non-filtered?

    I agree, this is really annoying for many layouts. It has been breaking mine all day.
    I found this which is simple & works a treat:



    haha. this is such a joke. still does it in 2.8.6. even wraps my comments in paragraph tags. thanks wordpress!

    To start, I am a newbie who knows basic html sort of. I am also an independent candidate for president of United states. Month of November I had 900 unique visitors and 54,000 hits. the site:

    I have uploaded word press to my hostmonster server via simple scripts. The tech guy @ Hostmonster said I have to upgrade the html.

    I truly do not know what to do, nor can I afford to pay anyone. What I want to have happen is at the end of every page a message / post box like this one I am typing into, so a visitor can comment on a page’s contents, ask me a question, etc.

    What do I have to do to make that happen? I like the way the home page looks and though i don’t have a template for the linked pages I sort of made it up as I went along. But I need a hand. Someone guide me what do I have to do?


    michael s levinson (oliver c kerr)

    Thanks the posting those plugin details eight7teen and chillstarr. Both and works to disable auto formatting, but the latter is easier to use so I settled with that. Thanks!

    I’m having the same probelm when in visual mode of page editor. I just posted a topic on it. I’m using 2.9.2 and this does not happen on all pages, just every so often.

    This plugin the holy grail of wordpress. Thanks for posting this! It solved all my html issues. I will never write another post without enclosing it in RAW brackets.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘2.8 HTML editor adding <p> and <br />’ is closed to new replies.