Disable WordPress Auto Formatting (wpautop)

WordPress have more features that make the user to use their back-end easily but, In some cases the user don’t want the automatic features that comes with the WordPress. They will do their formatting by themselves this auto formatting make the user to mess-up with tags, So they want to disable it. Here, we are going to discuss about “Disable WordPress Auto Formatting”.

WordPress Auto Formatting features come with the WordPress to replace new line with break tag <br /> and to replace the double line-breaks with paragraph tag <p></p> in page editor(WYSIWYG).

WordPress use the function wpautop to do this, We can hook into this function to customize the auto formatting. This function accepts two parameters, the first is the content to be formatted and the second determines whether to convert remaining line breaks into <br /> tags.

Disable both <p></p> and <br/> tags :

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

Disable only <br/> tag :

remove_filter('the_content', 'wpautop');
function wpautopnobr($content) {
return wpautop($content, false);
add_filter('the_content', 'wpautopnobr');

This code need to add into your theme file (function.php) to make it works. Please provided your valuable feedback/comments at below comment box.

Thank You !!


SIVA SANKAR, Working as a Software Engineer, Blogging is my hobby. I completed my Bachelors of Engineering (Computer Science Engineering) in Chennai, India. and my Master of Engineering (Embedded System Technologies) in Tamilnadu, India.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.