2012
08.29

Today I ran into a quite intresting and both anoying issue around WordPress and TinyMCE.

One of my clients reported, that they can’t even do a linebreak in WYSIWYG editor in their backend site which was powered by WordPress. So, I had to look for a solution. The only thing I found was to install TinyMCE Advanced, that had an option called “Stop removing >p< and >br /< tags when saving”. Which did the trick.

But I just hate to install a plugin just for 6 lines of code, without using the main functionality.

The other thing is that this is a multisite installation, so I had to do the activation process for all the sites… So I grabbed the related code from Tiny MCE Advanced, and placed into my admin tuning plugin.

After this I removed and deleted the plugin, but the original editor is totally gone.

The only thing I had was two errors in Firebug:

1
2
/wp-includes/js/tinymce/langs/en.js?ver=349-20805 - 404
/wp-includes/js/tinymce/themes/simple/editor_template.js?ver=349-20805 - 404

And a PHP warning:

1
Invalid argument supplied for foreach() in <b>/class-wp-editor.php</b> on line <b>432

After a half hour of searching and debuging I found out, what these symptons try to warn me. These are clearly the sings of missing TinyMCE init options. Because in the directory structure there is no directory /wp-includes/js/tinymce/themes/simple/ only ‘advanced’ one, which is the default theme for WordPress TinyMCE, and being set in the basic wp-editor class file wp-includes/class-wp-editor.php.

There is a hook in WordPress called ‘tiny_mce_before_init’.
Search for this string in your code if your TinyMCE is gone. If you find it in a plugin, try to comment out all the

1
add_filter('tiny_mce_before_init',some_function);

like lines, and yout will get your WYSIWYG editor back.

No Comment.

Add Your Comment