Answer the question
In order to leave comments, you need to log in
How to make wp code editor display symbols?
The bottom line is that characters are not visible in the visual editor
and they are not visible in the code editor either (the text is inserted by copying from the copywriting exchange). They are in the frontend, and if you inspect the element, you can see it
and, accordingly, the words are not transferred.
It is necessary that the TinyMCE editor displays these characters in any mode (does not matter), so that you can delete them, if any.
PS: I understand that this can be done in some kind of code editor before inserting into TinyMCE, but I want to skip this step
UPD: wp 4.9.10
Answer the question
In order to leave comments, you need to log in
If you mean the situation when you wrote using TinyMCE
in code mode , switched to the visual editor and switched back to the code editor, non-breaking spaces disappeared, and you would like to leave them, then this will help you:
function allow_nbsp_in_tinymce( $mceInit ) {
$mceInit['entities'] = 'nbsp,amp,lt,gt,mdash';
$mceInit['entity_encoding'] = 'named';
return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'allow_nbsp_in_tinymce' );
function remove_nbsp( $content ){
$content = preg_replace(" ", " ", $content);
return $content;
}
add_action('content_save_pre', 'remove_nbsp');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question