1

I'm struggling for two days and started here with success: Why Can't wp_editor Be Used in a Custom Widget?

I managed to have multiple TMCE on one page (displayed by a widget); all save data correctly. When i assign (as required) different IDs to each textfield, i get an upon clicking on the "visual" button (activating tmce):

'Uncaught TypeError: Cannot read property 'onpageload' of undefined'

When I assign a static ID to each textfield, the error is gone, but only the first textfield will get transformed to a tmce; the others remain regular textareas, no error.

I understand why the latter happens. I don't understand the error in first place, this is the resulting code, with a single tmce:

<textarea class="wp-editor-area" rows="30" autocomplete="off" cols="40" name="widgets[c29][wp_editor]" id="widget-bo_widget_rte-c29-wp_editor">this is text</textarea>

Im pretty sure this works in WP <4.8, since it uses TinyMCE <4 (??), but I can not find a solution for > 4.8

1

After three days i found a solution, many others are seeking (dozends of unanswered threads here and there) wp_editor() does not work in WP >4.8

Instead, use wp.editor Javascript-API: https://codex.wordpress.org/Javascript_Reference/wp.editor

| improve this answer | |

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.