I recently started using the classic tinymce editor after ages. For some reason, switching between the “visual” and “text” tabs completely messes with my layout. I have designed a report output that has some inline JS, CSS, and HTML. Anytime I (or one of the other site users) opens the visual tab it garbles the output, adds all kinds of crazy tags, renders the JS invalid, straight up removes some HTML elements, etc. After some searching, it seemed like the “autop” function might be the “culprit”, so I added this code to my site plugin:
add_filter(‘tiny_mce_before_init’, function($options) {
$options[‘wpautop’] = false;
return $options;
});
It didn’t do jack. Finally I have disabled the visual editor with this filter:
add_filter(‘user_can_richedit’, ‘__return_false’);
I like checking the output in the visual editor but it’s not worth having to reformat everything multiple times. I don’t want to disable autop site-wide because it has a purpose and the frontend output isn’t affected if I don’t use the visual editor (plus it may not even be the culprit). Has anyone else faced this issue?
[ad_2]