WordPress.org

Forums

Stop WordPress from adding p tags and removing line break (23 posts)

  1. Shiverwarp
    Member
    Posted 6 years ago #

    While updating pages (using wordpress as a CMS) it often seems to add <p> or ending paragraph tags, either arbitrarily, or I suspect when it notices a "return" or pressing enter on the keyboard. Seems kind of odd especially since I'm editing in html where it shouldn't matter.

    It also seems to simply get rid of <br /> when opening the page editor and it goes to visual, or switching back and forth in the tabs.

    Help? Is there any way to stop this? It's quite difficult when it keeps messing with my page structure and validating.

  2. Shiverwarp
    Member
    Posted 6 years ago #

    It also seems to be removing paragraph tags that I define within the html tab.

  3. pawsingleton
    Member
    Posted 6 years ago #

    Kinda having the same or similar challenge. I pretty sure <br /> doesn't work in wordpress postings, regardless of where you put them. As far as spacing is concerned, had and still might have a problem with getting a fully line break in between paragraphs.

    I just tried using "shift-enter" to create the space I needed and I think that might of helped.

  4. pawsingleton
    Member
    Posted 6 years ago #

    Never mind about the shift-enter thing. Thought it was working but apparently not.

  5. Shiverwarp
    Member
    Posted 6 years ago #

    You can add a line spacing for your paragraphs in your CSS, that might accomplish what you need, but it's still annoying that <br /> just simply breaks

  6. Shiverwarp
    Member
    Posted 6 years ago #

    Does no one else have this problem? Or is it simply a part of wordpress and I have to live with the weirdness?

  7. pawsingleton
    Member
    Posted 6 years ago #

    I did some searching around, and it appears that this has been an ongoing problem or (challenge) with wordpress. We are not the only ones :)

    There was a plugin I think called Text Control (?) that claimed to fix it or allow you to work with it or something. I didn't look to much into it since it was 4000 lines of code, was worried it would slow down my site.

  8. Shiverwarp
    Member
    Posted 6 years ago #

    Yeah I see that plugin aswell, but it looks really old and apparently stopped working even in older versions.

    It's obvious this is a problem. Can anyone help?

  9. daaber
    Member
    Posted 6 years ago #

    I'm having this same issue, it is adding p tags around everything and/or adding an ending p tag when it sees a opening div as well. Really bothersome.
    Did anyone find a fix?

  10. ebola5114
    Member
    Posted 6 years ago #

    i'm actually using TinyMCE Buttons Advanced plugin to solve this problem...

  11. bitkahuna
    Member
    Posted 6 years ago #

    p tags inserted are driving me nuts as i want to enter html for my page posts.

    ebola - not sure how an mce plugin will help because i thought it was wordpress putting in the tags - can you explain further? thanks

  12. bitkahuna
    Member
    Posted 6 years ago #

  13. bremmerm
    Member
    Posted 6 years ago #

    That plugin did not fix it for me....

    Also, TinyMCE Buttons only solves wordpress from stripping the page of br and p tags not from adding them....

  14. fishingfool
    Member
    Posted 6 years ago #

    @bremmerm

    The plugin that bitkahuna recommended http://urbangiraffe.com/plugins/disable-wpautop/ worked for me but I needed to un-check "Stop removing the <p> and
    tags" in TinyMCE.

    Give that a try:)

  15. hilti
    Member
    Posted 6 years ago #

    The TinyMCE plugin worked for me as well. Ensure you have checked the box at the bottom of the admin page for the plugin as specified by fishingfool and ebola.

    Thanks folks!

  16. jonpeltier
    Member
    Posted 6 years ago #

    I've been using TinyMCE-Advanced for a couple years, and it's always avoided WordPress' problems with editing HTML. In WP 2.9, however, the WordPress visual editor seems to be hosing everything. How can I blog about code when the blog eats the code??

  17. jchronowski93
    Member
    Posted 6 years ago #

    ditto. This WordPress changing code that I intentionally typed in is a pain. It sometimes works in one theme then not in another. I can only imagine that the themes I use that it works in have set spacing for the <p> tags, but I should get a straight line break by typing <br /> without adding anything. Why would you make something that removes things that people actually type in for a reason. This issue is going on for years and it is a shame that it has not been removed from WP. And the plugins don't always disable it.

    Short of editing the WP code itself that is doing this I can't figure out a thing...Then even that goes out the window after a WP core update...

  18. 60SecondMarketer
    Member
    Posted 6 years ago #

    I'm glad other people are having this problem. I know nothing about code, except what I've picked up using WP. All I know is I want a stinkin' blank line and it won't let me put one in. I thought I was doing something wrong, but then, it shouldn't be that hard to press Enter and get a line break...!

    Isn't this kinda a big issue? Why hasn't anyone at WP fixed this? ...or am I just naive thinking it's important enough for someone to care about? ...or is this their way of preventing extra lines, and thus unused space that has to be saved on some server somewhere?

  19. baloneyfeet
    Member
    Posted 6 years ago #

    This doesn't really solve much in the way of this issue, which I'm currently experiencing as well, but I found a workaround for the line break problem. I use the <hr /> tag and style it to be invisible. It has the same effect as a line break. Of course, if you want to use a visible <hr /> at some point, it means more styles, but that's one possibility anyway.

    I've actually had an additional issue where my <h2> & <h1> tags display the same size as the regular text. Changing the font size in the css does nothing.

  20. esmi
    Forum Moderator
    Posted 6 years ago #

    Changing the font size in the css does nothing

    Possibly because another piece of CSS (either further down the file or more specific) is over-riding it.

  21. dylanspurgin
    Member
    Posted 6 years ago #

    Adding this code at the top of my templates pages worked for me:

    <?php remove_filter ('the_content', 'wpautop'); ?>

    See this article for more info.

  22. Jacob N. Breetvelt
    Member
    Posted 6 years ago #

    @dylanspurgin

    Ok, looks great and simple solution to the p problem, but

    this will affect existing posts (?) i think i'm gonna try anyway...

    and not solve the problem of dissapearing <br /> when switching the editor in and out html.

    This is the reason why i only use the html editor and <br /> 's and no returns at places where newlining is critical

  23. roggel
    Member
    Posted 5 years ago #

    @dylanspurgin

    Thanks a lot! I tried the FCKEditor plugin and the TinyMCE Advanced plugin, like some people mentioned, but still WordPress was adding p-tags like crazy.

    Removing the wpautop filter by putting your line in my functions.php did the trick. It won't effect existing posts, but I only just started my blog so luckily there aren't many pages to update.

Topic Closed

This topic has been closed to new replies.

About this Topic