0

I'm on a virgin WordPress 5.2.3 installation with twenty nineteen theme using the classic editor. I'm facing the problem, that   entities added in text tab are removed once I edit the text in visual tab.

During research I've found this code:

function allow_nbsp_in_tinymce( $mceInit ) {
    $mceInit['entities'] = '160,nbsp,38,amp,60,lt,62,gt';   
    $mceInit['entity_encoding'] = 'named';
    return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'allow_nbsp_in_tinymce' );

src: https://wordpress.stackexchange.com/a/155857.

This allows me to switch from text to visual tab and back without removing the spaces. However, as soon as I change one single character in the visual tab, all the non-breaking spaces are removed.

I searched the web, but couldn't find any hints to this concrete problem.

What can I do to preserve the non-breaking spaces?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.