The WordPress post editor allows automatic editing of content before posting it. The system can insert quotation marks, indents, line break, etc. Sometimes these features cause pain to editors. Especially, if you need to design a page with complex formatting. The point is that even if you are working in the “Text” mode1, the auto format option is still active. The system keeps adding <p> and <br> WordPress tags. And as you can’t trace them visually in the editor, it’s impossible to remove the tags manually. Few words about <p> and <br> WordPress tags. By default, all paragraphs are wrapped in tags and ended with the line break. These particular tags can give a hard time to programmers and web-designers.
Note #1.
Deactivate Autoformat in WordPress
Disable <p> and <br> WordPress Tags With The Plugin
We suggest you to disable <p> and <br> with our plugin Clearfy. Download and install it. Go to the plugin menu. Here’s how to do it:
Settings => Clearfy menu
Go to Advanced. Find a block named Posts. Here you can change default settings for new posts. Scroll to the bottom of the page to disable autoformat of <p> and <br> WordPress tags. Just click ON.
Disable <p> and <br> WordPress tags using the code
If you want to prevent adding <p> and <br> by default and don’t want to use plugins, feel free to do it with the code. Unfortunately, you’d have to modify functions.php. It’s quite risky, though. If the person who changes the theme code doesn’t know much about the program settings, the consequences can be catastrophic.
So, go to the file manager of the hosting and find functions.php. Add the following fragment to the file:
// disable <p> and <br> in postsremove_filter( 'the_content', 'wpautop' );// disable <p> and <br> in previewremove_filter( 'the_excerpt', 'wpautop' ); // disable <p> and <br> in commentsremove_filter( 'comment_text', 'wpautop' );
Conclusion
We’ve shown you several ways of disabling autoformat for <p> and <br>: with the Clearfy or using the code. If you choose to use the code it will definitely upgrade your tech skills. However, be ready to the possible damage caused by incorrect changing of the theme code. There’s another way – to use Clearfy. The plugin developers guarantee Clearfy safety and functionality. Follow our guides and remove autoformat with Clearfy in no time.