How to stop WordPress from adding extra ‘p’ tags and line breaks automatic in post content
Many time while we updating pages or posts in WordPress, it automatically adds extra p and br tags automatically at the end of paragraphs. This behavior specially happens when copying text from other source file to the WordPress editor. This can be really frustrating and keeps on messing with the page structure.
You can solve this by plugin also, but i don’t recommended for it. A small 2 line code can solve this issue.
Some people choose to disable the wpautop filter from within their theme’s functions.php. Go to your theme function.php file and add below code.
/* Disable Automatic P Tags */
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );