07 Jul

Automatically Reenable WordPress Paragraph Breaks

We had a phone call from a client late this Friday afternoon looking for some WordPress Support.

Having upgraded a very old website themselves to version 4.8 they noticed that all paragraphs on the website were running into each other without linebreaks.  WordPress has a function called wpautop which finds line breaks and manually converts them into html paragraphs. This ensures that each paragraph sits on it’s own line, usually separated from other paragraphs with top or bottom margin. They needed a quick fix. Having taken a very cursory look it appears that wpautop was being disabled by one of the many plugins on the site. For a quick win we were able to reinstate wpautop by adding the following into functions.php:


function renable_wpautop(){
add_filter('the_content', 'wpautop');
}
add_action( 'after_setup_theme', 'renable_wpautop' );

It was a very quick fix for a late Friday afternoon but it’s got the client out of trouble until we can take a look early next week.

Share this

Leave a reply