Often while updating pages or posts in WordPress, it automatically adds p and br tags automatically at the end of paragraphs. This behavior specially happens when copying text from HTML file to the WordPress editor.This can be really frustrating and keeps on messing with the page structure.
There are 2 ways of fixing this issue :
1.Fixing using plugins.
There are plugins available that help fix this issue. Some of the popular plugins are :
There are many other plugins available as well, but these are some of the most popular available plugins.
2.Adding code to the Theme templates.
Sometimes plugins don’t work on your setup or certain plugins running together might break your site. In such cases, just add the following line to the top of your theme’s page and post templates.
Usually these files can be found under ‘…wp-contents/themes/mytheme/‘ folder with the name ‘single.php‘ and ‘page.php‘
remove_filter ('the_content', 'wpautop');