• I’ve looked all over the place and tried every solution out there, but I’m still running into this problem.

    Anytime I’m trying to use HTML for my posts and add two <br> tags, WordPress automatically strips the line breaks and wraps my text in <p> tags instead. I’ve already tried adding this code to a custom.php file no avail:

    remove_filter( 'the_content', 'wpautop' );
    remove_filter( 'the_excerpt', 'wpautop' );

    I’ve also tried different plugins that claim to fix this issue, and I still can’t seem to get it to work. I’d just like the posts to look exactly how I intend when I use HTML. Nothing added, changed, or stripped.

    • This topic was modified 4 years, 9 months ago by iyasu.
    • This topic was modified 4 years, 9 months ago by iyasu.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    A custom.php file? How and when does that get included? It may be executing too early. You cannot remove something before it had been added 🙂 You may need to place the remove calls in a callback added to a later action. Using “init” with a large priority arg ought to be late enough.

    What editor are you using where you can add break tags? It may be invoking wpautop() before output, which is where “the_content” is applied. There may be another filter to remove.

    FWIW, p tags are more conducive to proper CSS styling than double br tags. IMO you’re better off styling p blocks as you wish than fighting wpautop().

Viewing 1 replies (of 1 total)

The topic ‘How to stop auto formatting / p tags?’ is closed to new replies.