How can I disable automatic paragraph tags, but retain line breaks?
I have used this to remove wpautop:
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
But there are no more line breaks in the text.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityHere's the full solution.
First disable wpautop in your functions.php
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
Then parse your content/excerpt with nl2br (a standard PHP function).
add_filter( 'the_content', 'nl2br' );
add_filter( 'the_excerpt', 'nl2br' );
<br />
tags, I assume? (EOLs should be there)