WordPress.org

Ready to get started?Download WordPress

Forums

stop wordpress from inserting line breaks in my code!! (7 posts)

  1. oats
    Member
    Posted 6 years ago #

    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!

  2. oats
    Member
    Posted 6 years ago #

    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.

  3. whooami
    Member
    Posted 6 years ago #

    WordPress wants to add its own ..

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

    google for: disable wpautop :)

  4. phreakymonkey
    Member
    Posted 6 years ago #

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

  5. moshu
    Member
    Posted 6 years ago #

    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.

  6. oats
    Member
    Posted 6 years ago #

    <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?

  7. moshu
    Member
    Posted 6 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic