Yes, I am aware of it that there are tons of solutions out there which prove that they work.
I am FURIOUS right now having troubles with this for hours, such a stupid silly problem should not at all take any time to solve in a complex CMS WordPress.
No, none of the solutions worked for me, TinyMCE advanced does nothing (how do I even add exclusions or whatever? I don’t even see options for that).
I have tried several other plugins stating that it solves the problem, but they only solve it partially, stopping TinyMCE from stripping some of the tags or so.
Overriding TinyMCE options did something, but still messes up my code really badly:
function override_mce_options($initArray) {
$opts = '*[*]';
$initArray['paste_word_valid_elements'] = $opts;
$initArray['valid_elements'] = $opts;
$initArray['extended_valid_elements'] = $opts;
return $initArray;
}
add_filter('tiny_mce_before_init', 'override_mce_options');
Even when only using the “text” option, and not switching to “visual” tab not working, it still messes up my HTML.
The thing is, I want TinyMCE to NOT TOUCH my code at ALL, I want it so that I can use the editor to add, but I don’t want the editor to do anything with the already added code.
Any idea would be greatly appreciated, as this is a highly common problem with no real solution so far. (at least not for me) Should I just give up using TinyMCE?
EDIT: I am using a custom TinyMCE field created with WP_Editor() and using it for sending emails.
It sounds like you’re having a problem with how wordpress saves the data, not actually tinyMCE. For example, wordpress will attempt to balance the html tags ( https://codex.wordpress.org/Function_Reference/force_balance_tags ). It also does some things on output of “the_content()” like filtering with https://codex.wordpress.org/Function_Reference/wpautop.
Also, keep in mind that tinyMCE is meant for rich text editing, not code as a code editor.