WordPress automatically removes line break
When writting a description for a Woocoomerce Product and inserting a line break with br or p Tag, WordPress automatically removes it. This is really annoying because on some points, i want to have a little line break.
I often found the solution to install TinyMCE. After that now WordPress doesnt removes the p Tag anymore but inserts a nbsp inside of it and so the line break is way to big.
So i want a line break like a p Tag, because npsb produces way too much space between two sentence.
I also tried following solutions:
add some attributes to the p Tag like
p data-x /p
Wrap the p Tag with comments like
!-- wp:html -- p class=beer/p !-- /wp:html --
- Added some hooks in the functions.php like
add_shortcode(br, br_tag); function br_tag(){ return(br/); }
or
remove_filter('the_content', 'wpautop'); remove_filter('the_excerpt', 'wpautop');
and
remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); function wpse_wpautop_nobr( $content ) { return wpautop( $content, false ); } add_filter( 'the_content', 'wpse_wpautop_nobr' ); add_filter( 'the_excerpt', 'wpse_wpautop_nobr' );
- I tried following solution but it doesnt work Wordpress automatically adding nbsp;?
The best solution i found was to NOT using the visual AND the text editor, but for me thats such a temporary one.
Specs:
WordPress 5.6
Advanced Editor Tools (previously TinyMCE Advanced): 5.6
WooCommerce: 4.6.1 (but in my opinion, its not a WooCommerce problem)
Does anyone know a better solution or a reference for that problem?
Topic woocommerce-offtopic line-breaks plugins Wordpress
Category Web