How to prevent double enter on text editor
Stop WordPress from turning every Enter in the text editor into a full paragraph break, by adding one small PHP snippet to your Listivo child theme.
1 minute read
First you need a child theme for Listivo: How to use a child theme and change files (php / css / js) while keeping future update compatibility
Then add this PHP code to the functions.php file:
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
function aiooc_crunchify_wpautop_nobr( $content ) {
return wpautop( $content, false );
}
add_filter( ‘the_content’, ‘aiooc_crunchify_wpautop_nobr’ );
add_filter( ‘the_excerpt’, ‘aiooc_crunchify_wpautop_nobr’ );
Result:
This code removes the p tag when you hit Enter.
Ask the people who build Listivo
We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.
We can also run your site for you, or build a new one.
Was this guide helpful?