WordPress.org

Ready to get started?Download WordPress

Forums

Disable automatic p and br tags in HTML editor (10 posts)

  1. itissue
    Member
    Posted 6 years ago #

    Is there a way to disable the automatic <p> and <br> in the HTML editor? It's messing up my code that I type by placing lots of <p> and <br> wherever I have line breaks. I only want line breaks when using the rich text format.

  2. itissue
    Member
    Posted 6 years ago #

    Any sort of help will be much appreciated.

  3. TheNewDominion
    Member
    Posted 6 years ago #

    I'm having the same problem. I've installed the exec-php plugin on my site, and I'm making a page called "Tag Cloud" and am using the php function <?php wp_tag_cloud('smallest=8&largest=22&number=50'); ?> to automatically display the tag cloud on the page. The default format is "flat," which I believe means it will just put some white space between each tag to result in a paragraph-looking cloud of tags. However, the automatic br tags are placing br tags between each tag, resulting in a long, long list.

    I understand wordpress wasn't originally designed to handle php inside a post or page, but I think this really just boils down to the automatic br tags.

    I don't see any way to fix this problem except to disable the automatic p and br tags in the HTML editor, just as itissue has asked.

  4. accuweb
    Member
    Posted 5 years ago #

    Hello All,

    It seems that you guys are using MS Word to write a post and copied into the HTML Editor. I recommend to use either any except MS Word to write a post. Because due to MS Word your blog may add br and P tag automatically at start/end of the post.

    Thanks,

    Shane G.

  5. cyberanto
    Member
    Posted 5 years ago #

    I tried all tricks and there is no way that wordpress keeps the
    tabs in the programing code. Therefore I had to use something else. I tried tables!

    Using tables will make you use more programing, unless you use the TinyMCE Advanced plugin, which helps you use tables more easily.

    With tables, when I need a single line break, I switch to the next row of the table. If I need a double line break, I leave an empty row in the table (<tr><td></td></tr>) The result, it gives me something like this.

  6. bchan
    Member
    Posted 5 years ago #

    Does anyone know whether this is fixed in 2.7? I don't seem to be able to save any class to any <p> or

      tags in my post.

      <p class="some_class">blah</p>

      will turn into

      <p>blah</p>

      after clicking 'Save'.

  7. sello
    Member
    Posted 5 years ago #

    After struggling with this frustrating problem, I solved it by using the text control plugin: http://wordpress.org/extend/plugins/text-control.

    Once installed and activated, go to Settings->Text Control Config.
    Under "Posts & Excerpts", select "No Formatting" in the first drop down list.

    That should get rid of all the automatic break tags being inserted.

  8. krembo99
    Member
    Posted 5 years ago #

    there is another solution

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

    for example ( TheNewDominion ) - put this anywhere on your page

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

  9. bchan
    Member
    Posted 5 years ago #

    Thanks for the suggestions. But what about the missing CSS classes? Text-control only removes the automatic break tags. Does it also keep the classes I added in the tag? Please advise.

  10. Presswurst
    Member
    Posted 5 years ago #

    I would like to disable automatic tags like <p> for code like <!--plugin--> which some plugins are using.

    TinyMCE converts to <p><!--plugin--></p>

    This causes invalid code because the code of the plugin starts with <div>...

    Is there a remedy for this special case?

    Well, I could write <div><!--plugin--></div> but it would be more complicated...

Topic Closed

This topic has been closed to new replies.

About this Topic