• Skip to primary navigation
  • Skip to main content

Thats Journal

  • Home
  • About
  • Digital Marketing
    • Affiliate Marketing
    • Branding
    • Content Marketing
    • Email Marketing
    • Marketing
    • Sales and Marketing
    • SEO
  • Social Media
  • Influencers
  • Resources
  • WordPress
    • WordPress Plugins
    • WordPress Themes
  • Sitemap
  • Contact Us
  • Show Search
Hide Search

Disable Automatic Insert Of p, br Tags In Posts In WordPress

admin · Jan 22, 2013 · 4 Comments

WordPress automatically inserts <p> </p> and <br /> tags in the “Text” section in your posts and pages. When you are writing any codes or in some situations it becomes very annoying when you get <p> </p> and <br /> tags automatically filled in your posts. To disable this feature, open the functions.php file of your WordPress theme. Add the below given lines of code:

remove_filter( ‘the_content’, ‘wpautop’ );
remove_filter( ‘the_excerpt’, ‘wpautop’ );

That’s it. WordPress will not automatically put <p> </p> and <br /> tags in your posts and pages.

Note: If you are still facing the same problem, even after you made the above changes. Simply trash the post which you were working on and create a new one. That will solve it.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • More
  • Click to print (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Skype (Opens in new window)

Related

Download thousands of Themes, Plugins & Graphics to create your Website. Use promo code ThatsJournal and get an additional 10% off for All MonsterONE Plans.

Pro Blogging automatic, automatically, codes, disable, edit, editing, editor, element, filled, insert, line break, pages, paragraph, Text, Theme, write, writing

About admin

Thanks for dropping by! This post was published by the Editorial Team of Thats Journal. Follow us on our social media channels for current trends on Digital Marketing, Social Media Marketing and WordPress Themes.

Disclosure: Thats Journal is supported by our readers. This page may contain affiliate links. That means, if you click on these links to make a purchase, we may earn a small commission (at no extra cost to you). These funds help us to keep this blog up and running.

Categories

Subscribe via Email

Enter your email address to subscribe to Thats Journal and receive new posts by email.

Join 38,252 other subscribers

Join Our Community of 50,000+ Bloggers And Authors!

Reader Interactions

Comments

  1. Straub Creative says

    October 26, 2014 at 12:58 am

    Yup, that solution works, but removes all paragraphs entirely from the site – even if on some pages / posts you need them. Any suggestions on toggling this feature for specific pages / posts?

    The reason I ask is we need the auto p function removed for literally one page because it’s breaking some javascript code. All of the other pages where is inserted is fine.

    TIA!

    Reply
    • admin says

      October 26, 2014 at 5:41 am

      You can try this WordPress plugin. By using this plugin you can control automatic insert of paragraph and line break tags on a per post basis.

      Reply
      • Straub Creative says

        October 26, 2014 at 6:01 am

        Yea, I’d definitely say out of all of the plugins I’ve tried, that one is the best. Another suggestion I got from a developer that works on other themes is if none of the other plugins work, just try custom coding it into functions.php, like this:

        function remove_p_on_pages() {
        if ( is_page() ) {
        remove_filter( ‘the_content’, ‘wpautop’ );
        remove_filter( ‘the_excerpt’, ‘wpautop’ );
        }
        }
        add_action( ‘wp_head’, ‘remove_p_on_pages’ );

        …this way the page looks through the check in the section first before the WP filters take effect, in this case by seeing if the document is a page or not, and if it is, run the filter.

        Unfortunately I had to get stuck with a buggy theme and had to email the devs on this one because nothing works, but hopefully they can help. Thank you too for your comments and for the post, you helped me on the right track!

        Reply
        • admin says

          October 26, 2014 at 8:12 am

          You are most welcome! I am glad the post was helpful.

          Reply

Leave a Reply Cancel reply

Copyright © 2023 Thats Journal