WordPress.org

Support

Support » How-To and Troubleshooting » stop wordpress from inserting line breaks in my code!!

stop wordpress from inserting line breaks in my code!!

  • I use the code view in WordPress for editing posts, but still WordPress wants to add its own <p> and
    elements in some places when posts are rendered.

    This is screwing up my site, because I paste in the code box exactly what HTML code I want, but once the page is published I have extra spaces and line breaks all over the place. When I view the source, I see p’s and br’s added at almost every new line. For example, line breaks are added between table cells, td’s, tr’s and other elements!

    Why doesn’t wordpress respect the HTML code I enter? Please help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I forgot to add: I get the same results when I try to post with desktop blogging software, like ScribeFire or Ecto. WordPress still inserts the ‘p’ and ‘br’ linebreak tags. Interestingly, they never show up in the code-edit view. These extra tags only show up when viewing the actual page.

    whooami

    @whooami

    Member

    WordPress wants to add its own ..

    thats called wpautop, and there are handfuls of plugins to disable it.

    google for: disable wpautop 🙂

    Having similar issues. It’s a pain to place images when they’re getting wrapped in <p> tags.

    For example, line breaks are added between table cells, td’s, tr’s […]

    I don’t like either if a program “knows” better what I wanted to code. However, for the sake of the truth, I have to say the above statement is completely wrong: I just tested in 2.2.1 and 2.0.10 – a correctly written table code does not get any breaks (br) in between.

    <p>asdfasdf asdfa dasdfasd
    asdf asldkfasdf jksdlf jaksdf
    
    <TABLE>
    <TR>
    <TD>
    words in
     cell
    </TD></tr>
    </table>

    well I found out that wordpress does not like mixed cases with tags. there is nothing wrong with the above table, but wordpress adds line breaks all over the place. if i make the ‘table’ and ‘td’ tags lowercase, it behaves much better. bug?

    also it still puts a ‘br’ tag between ‘words in cell’. i wish it wouldn’t.

    is there a plugin that disables this wpautop only for code-edit entries?

    well I found out that wordpress does not like mixed cases with tags

    It’s not WP. It is the XHTML rules! Good reading:
    http://www.w3schools.com/xhtml/default.asp

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘stop wordpress from inserting line breaks in my code!!’ is closed to new replies.
Skip to toolbar