WordPress.org

Ready to get started?Download WordPress

Forums

Turn off BR filter... (45 posts)

  1. chuckg
    Member
    Posted 10 years ago #

    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: http://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 :)

  2. OtherMichael
    Member
    Posted 9 years ago #

    I have no answer to the added break tags, either. I could have sworn I saw one once, though. :::sigh::: Why the heck would it add the stupid things, anyway? If I wanted WYSIWYG I ask for WYSIWYG....

  3. Mark (podz)
    Support Maven
    Posted 9 years ago #

    "This allows you to add custom fields to a post to disable auto-formatting and/or auto-smart-quote conversion. Latest Release: Version 1.0, 2004-05-21."
    http://www.alexking.org/software/wordpress/1.2/wp-unformatted.zip
    Any good ?

  4. OtherMichael
    Member
    Posted 9 years ago #

    Whoah. Why should I have to add something to WordPress to make it stop adding things nobody asked for?
    I mean, why would those break-tags be there, anyway? I'm formatting my posts correctly, everything is happy...I have extra spaces in them so I can read and parse it visually (becuase I ma not a browser). Almost every browser in the world ignores spaces and line breaks. So why does WP add them in? This is not a feature--it is an extremely annoying bug.
    Is there any more documentation on that plug-in? His one-sentence description doesn't exactly do it for me.

  5. OtherMichael
    Member
    Posted 9 years ago #

    Gosh, I'm a whiner! Sorry.

  6. ElasticDog
    Member
    Posted 9 years ago #

    There are two plugins that do it conditionally, which can be controlled by adding meta data to your entry...I also wrote a plugin, which hasn't been put up anywhere yet, that just turns off the auto-formatting by for all entries, with no control since I like to control my output...I figure if Ibreak it, I'll fix it :-)
    If you're interested in the code, I can put it up somewhere real quick.

  7. OtherMichael
    Member
    Posted 9 years ago #

    Maybe this thread is germane?

  8. OtherMichael
    Member
    Posted 9 years ago #

    How sad that Blogger actually allows you publish non-screwed HTML, but WordPress makes you install a plugin to stop it from screwing it up.

  9. Matt Mullenweg
    Troublemaker
    Posted 9 years ago #

    Thanks for your opinion. If you don't want autop to run on your code, just use remove_filter. If you think it's a bug in the processing, please post the code it messed up here:
    http://wiki.wordpress.org/?pagename=autop-bugs

  10. OtherMichael
    Member
    Posted 9 years ago #

    Heh. Thank you for your restrained diplomacy. I've been posting far to much about this issue, only it was really getting under my skin today.
    I took the advice listed in another thread and In includes/functions-formatting.php changed $br = 1 to $br = 0 in the autop function.
    Still, I hope to see a check-box or some-such under Options in the future.

  11. Brak
    Member
    Posted 9 years ago #

    I don't. It's a feature that, quite frankly, very few people care about. If we were to include an option for every thing in WP that every single minority wanted - we'd have such a complicated options page that new users would be scared off.
    Sometimes you have to think whether the feature you're asking for is really for the common good, or your own good.

  12. Joshua Sigar
    Member
    Posted 9 years ago #

    echo Brak

  13. zach
    Member
    Posted 9 years ago #

    I completely agree with OtherMichael. We should have the ability to turn off this automatic formatting without installing plugins, adding extra fields, or altering the code. This should be part of the core distribution. It would be an extremely easy feature to include, and it won't scare off timid users -- that is who the "Simple controls" setting is for. The "Advanced controls" only have 3 or 4 minor additional features, and this is a perfectly logical 5th. It can be deselected by default -- no one gets hurt ;)

    I understand Brak's argument against adding complicated features for the few, but I'm willing to bet we aren't as few you think; but even if we are a minority, we are an important minority of advanced users capable of forming our own html and don't want our tool to fight against us every step of the way.

    A feature shouldn't have to be requested and used by 51% of the user base to be included, especially if it's tucked into the Advanced tab where the average user fully expects to be confused by some of the options anyway. After all, tell me honestly, how many people need "Geo Tracking Features" in the default install, now that should be plugin ; )

    The main reason for my reply is to be counted in this few. Others reading this post who agree with OtherMichael and me should also chime in.

  14. Login to your admin interface, go to Options/Writing, uncheck "WordPress should correct invalidly nested XHTML automatically".

  15. zach
    Member
    Posted 9 years ago #

    macmanx: That doesn't help, I still get dangling p tags peppered throughout my markup.

    I seem to remember something about having block level elements inside list items possibly causing this problem, I'll look into it.

    When I comment out the wpautop filter in the code it works ok, and I can deal with it, but it took me a ridiculous amount of time to locate this bug and fix it with a hack.

  16. Matt Mullenweg
    Troublemaker
    Posted 9 years ago #

    remove_filter('the_content', 'wpautop');

  17. NuclearMoose
    Member
    Posted 9 years ago #

    Flagged for Codex

  18. zach
    Member
    Posted 9 years ago #

    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

  19. onenationunderdog
    Member
    Posted 9 years ago #

    use this:
    http://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>

  20. zach
    Member
    Posted 9 years ago #

    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

  21. chuckblue
    Member
    Posted 9 years ago #

    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.

  22. Shonky
    Member
    Posted 8 years ago #

    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

  23. bwooster47
    Member
    Posted 7 years ago #

    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.

  24. ladydelaluna
    Member
    Posted 7 years ago #

    "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)

  25. yosemite
    Member
    Posted 7 years ago #

    Check dates, old thread. Dust. Cobwebs.

  26. ladydelaluna
    Member
    Posted 7 years ago #

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

  27. bwooster47
    Member
    Posted 7 years ago #

    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.

  28. yosemite
    Member
    Posted 7 years ago #

    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".

  29. Bruce21
    Member
    Posted 7 years ago #

    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.

  30. Bruce21
    Member
    Posted 7 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic