• Ok, this has been bugging me for days now. Inserting codes in my post has been a pain in the ass. It keeps putting <p> or <br /> tags in the middle of my codes and causes it not to work. No matter how I tried to put all my codes into one line, it will still manage to squeeze in some <p> or <br /> tags somewhere in the middle of it. I’ve searched high a low for the part that causes it but to no success.

    I noticed whenever I create a post, it will convert <p> tags to \r\n and when viewing the post, it will convert the \r\n back to <p> tags. Well… I hate that feature. I want <p> tags to stay as <p> tags all the way.

    I just want to know how or where can I disable it. I’ve tried disabling alot of search and replace codes but still won’t work. I don’t want a plugin or tags. I just want to disable it once and for all.

Viewing 4 replies - 1 through 4 (of 4 total)
  • It’s part of WordPress’ auto-formatting features, and the only way to ‘turn it off’ is to either

    1. Comment out or remove the

    add_filter('the_content', 'wpautop');

    line in wp-includes/auto-filters.php.

    2. Make use of a plugin like TextControl, which allows you to disable various text formatting functions.

    If you are manually handling <p>, <br /> and other such tags in your posts, I’d also make sure to turn off the visual rich editor option under your profile, and stick to the default (plain) editor.

    Thread Starter eddyvlad

    (@eddyvlad)

    Umm… there’s no auto-filters.php. And disabling that line doesn’t work. And the plugin doesn’t work either. And I thought I’m the stubborn one.

    there’s no auto-filters.php.

    Sorry, it’s default-filters.php. I’m a little rusty on WP filenames…

    And disabling that line doesn’t work.

    Can you describe what “disabling” here means? If you comment it out (or remove it) from that file, it should indeed stop wpautop() from being called and so keep it from handling auto-formatting of paragraphs and breaks withing posts displayed on your blog.

    And TextControl does work. In fact I just downloaded and installed it on my test site, went to Options > Text Control Config, set Posts & Excerpts to “No Formatting,” and (no surprise to me) the content of my posts lost all formatting.

    Thread Starter eddyvlad

    (@eddyvlad)

    I just found out that nl2br works the best and without encoding. Want to stop using the rich editor. It’s killing me. Thanks guys.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Paragraph tags to double new lines?’ is closed to new replies.