• In an attempt to add new hacks to my website, rather the directions for implementing them, I’m relying heavily on the PRE tag and all that entails. The problem I’ve run into when handling whitespace, is that WordPress insists on adding BR’s after every line, which when using whitespace set to PRE, adds an additional break line that I don’t really want.
    Does anyone know of a method (or a hack) that turns off the BR’s for a time? A perfect example of what is happening can be found here: https://www.blindmuse.com/archive/2004/03/31/group-archives-by-year/
    Note the extra line breaks between lines, which I do not want. The reason I’m using white-space: pre is that it keeps the formatting for tabs between functions and what not. So, this is my cry, hear it someone ??

Viewing 15 replies - 16 through 30 (of 44 total)
  • Flagged for Codex

    remove_filter('the_content', 'wpautop');

    Where exactly am I supposed to put that?

    I tried putting it in my-hacks.php but it did not work. (I made sure the legacy my-hacks.php box was checked) WP 1.2.2

    use this:
    https://www.coffee2code.com/archives/2004/06/27/plugin-wpuntexturize/

    open it up and you’ll see how str_replace is used … in parens, first the string to be replaced; then what to replace it with.

    so to remove <br />, put it in the first set of single quotes and in the second put nothing.

    you can manually insert a line-break in a post by using different syntax – even just the above in caps… or god forbid the old <br>

    But I don’t want to remove s I want to stop wordpress from adding and
    around every block of text in my post. I want to be able to create my own markup because the wordpress wpautop filter is worthless to me. I despise it. All I want, is to have my post interpreted as straight up html – thats it!

    I don’t want to remove all s from my post because I want to be able to use them as I see fit. So I don’t want to do string replacements.

    Allusion says

    just use remove_filter

    Nuclear Moose says

    remove_filter('the_content', 'wpautop');

    Neither provide any details as to how or where we are supposed to use this. or is this just something I chant while holding a crucifix?

    Where am I supposed to put that?

    I am so godammed tired of fighting with worpdress over these p tags.

    WHY does it still put them around everything I do?

    I have read every single post on this website, and participated in every discussion yet I am unable to remove this ridiculous behavior.

    For the record, so far I have

    1) unchecked “correct invalidly nested XHTML automatically”

    2) gone into “template-functions-post.php” and commented out the line that reads add_filter("the_content", "wpautop"); (as suggested here

    3) checked “Use legacy my-hacks.php file support” 4) created a “my-hacks.php” file with the following lines:

    remove_filter("the_content", "wpautop");
    remove_filter("the_excerpt", "wpautop");
    remove_filter("comment_text", "wpautop");

    5) removed all whitespace from my markup before pasting it into wordpress.

    6) tried alternate versions of wordpress, including nightlies, hoping there is a bug somewhere.

    None of these measures or combinations thereof have mattered. I have been very conscious of clearing my cache and even creating brand new test posts – nothing works.

    Using WordPress 1.2.2

    Hmm. I wondered where those dangling p tags were coming from. I know that I know better than to leave them in. I’m a poorly drawn typist, but I do look for such things in my regular html pages. At least this set of posts clears up why they were showing up. I dislike them being there.

    I too have been having a problem with the aformentioned filter, I changed “apply_filter(“the_content”, “wpautop”);” to “remove_filter(“the_content”, “wpautop”);” in “default-filters.php”. This fix worked for me using WordPress 2.0

    Just wanted to add my support for this issue – need a easy way in WP to have it disable adding br and p tags all over the post.

    Drupal has this, but Drupal is pretty heavy weight for a particular web site I’m building, so wanted to use WP, but having it always force br and p tags all the place really messes up many of posts – when I need to add some Javascript, or some Flash object/embed tags, or copied HTML code from elsewhere. All these get totally messed up.

    “Using WordPress 1.2.2”

    Can I ask why? We’re up to 2.0.4 right now, and there are a ton of security issues, updates, and more that have been taken care of.

    Could it be possible that the solutions you’ve been given don’t work with your version, and maybe upgrading to the latest would do it? (Note: You’d have to upgrade to 1.5 first, then to 2.0.4)

    Check dates, old thread. Dust. Cobwebs.

    Gah… you’re right.
    I’m so bad at that!

    Wait! I posted my message on 2006-08-13 12:37:03 – I’m using the latest version 2.0.3 – but all problems mentioned in this issue remain.

    For example, I’m not using the Rich Text Editor, and have turned off “correct invalid XHTML”

    Even then, if I enter a Flash object in my posting:

    <object …

    it gets saved with a br tag at the line end, and every input line gets a br tag, completely breaks the HTML.

    So, the br sprinkler is not very intelligent – and I understand this works fine for a “majority” of users, but sooner or later, these users will need to cut-n-paste some HTML/JavaScript/object/embed tags in their posts, and it will totally break with absolutely no way to work around it.

    Wait! I posted my message
    You posted it to an 18-month old thread regarding far different versions.

    I’m using the latest version 2.0.3
    Upgrade to 2.0.4.

    it gets saved with a br tag at the line end
    If it persists, try not using “line ends”.

    I add my 2 cents. As a programmer I use Movable Type or Expression Engine for code work as they both have a simple option to turn off formatting for a post or even part of a post. A simple matter that seems impossible with WordPress.

    When I am adding code for flash or other things that don’t allow break tags, I do not want break tags, and tightening up the code does not work.

    Note: Topic started 2 years ago…Topic NOT resolved…

    i really need a solution to this problem asap. WordPress is converting my linebreaks to <br/> and i rreally cant have that ?? did anything work for anyone?

Viewing 15 replies - 16 through 30 (of 44 total)
  • The topic ‘Turn off BR filter…’ is closed to new replies.