Disable autop in WordPress

If you do not like automatic paragraph formatting, known as autop in WordPress, you can disable it in the content and/or excerpt view of your posts.

Add the following lines of code to child theme‘s functions.php file. If you don’t have a child theme, consider creating a custom functions plugin for your site. Custom functions plugin is better than modifying your theme files or using a third-party plugin.

/* disable autop from content view */
remove_filter('the_content', 'wpautop');
/* disable autop from excerpt view */
remove_filter('the_excerpt', 'wpautop');

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.