0

Just updated WordPress to new 3.9, new features are great, love them. Only got some issues with tinyMCE 4. I use wp_editor to create multiple tinyMCE editors with custom field.

Here is the code:

$tinymce_opt = array(
 'height'    => "250",
 'plugins'  => "nz_button, line, gap, slider_colorbox, icon_list, icons, font_size",
 'toolbar1' => "formatselect,fontselect, styleselect,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,forecolor,removeformat,charmap,undo,redo",
 'toolbar2' => "nz_button, line, gap, slider_colorbox, icon_list, icons, font_size",
 'toolbar3' => ""
);

 $settings = array (
    'tinymce'       => $tinymce_opt
   );
  wp_editor( ${"layer_$i"}, "layer_$i", $settings);

Everything is fine. The problem is that it does not understand plugins (my custom shortcodes, that i created). Custom shortcodes work fine in regular wp editor, but in multiple wp_editor, it just does not find them.

In colsole i get error 404 can’t find

for example “line” shortcode

http://mywebsite.com/wp-includes/js/tinymce/plugins/line/plugin.min.js 404 (Not Found)

All my custom shortcodes are ignored, not found.

Does anyone know, how to tell tinyMCE + wp_editor to use custom shortcodes?

My custom shortcodes are located in my theme

P.S. It worked fine with old tinyMCE.

  • What is the actual value of ${"layer_$i"}? – fuxia Apr 23 '14 at 10:30
  • I don't have an answer for your question, but I wanted to point out that the text alignment button names have changed (possibly without warning... grrrr) in WordPress 3.9. You'll need to change "justifyleft,justifycenter,justifyright" to "alignleft,aligncenter,alignright". – Andy Giesler May 15 '14 at 15:25
1

Since 3.9 some parts of the settings for the original Editor are wrapped in a self::first_init condition. This includes the plugins filter for external tinymce plugins. So, in a subsequent call for an editor, the filter won't run.

Solution: One can pass a tinymce settings array to the settings of wp_editor(), that's where I would start. Or enqueue the script manually as explained here:

http://www.tinymce.com/wiki.php/Tutorials:Creating_a_plugin

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.