How to stop WordPress from adding extra paragraph tags

If you’ve used WordPress for any period of time, you know it has the annoying habit of adding extra paragraph tags when you don’t want or need them. This can cause problems with the way your content is displayed. Luckily, this is easy to fix.

Add the following code to your theme to prevent WordPress from adding those extra paragraph tags.

<?php
/* Stop WordPress from adding those annoying paragraph tags */
  remove_filter( 'the_content', 'wpautop' );
  remove_filter( 'the_excerpt', 'wpautop' );
?>

When using this code, make sure the content you’ve already published isn’t affected in ways you don’t want.

Leave a Reply