In the backend, after an event I make an ajax request which populates certain fields. The problematic field is the textarea, for which I use wp_editor like so:

<?php $settings = array( 'textarea_rows' => 6 ); ?>
<?php wp_editor('', 'pd', $settings); ?>

Upon success, I have the following:


But I keep getting the following error:

TypeError: tinymce.get(...) is null

I guess it is not finding the textarea in question, but I do not know how to remedy this.

  • Do you create the TinyMCE instance in the AJAX file?
    – fuxia
    Nov 3, 2014 at 12:14
  • no, how would I do that? Nov 3, 2014 at 12:19
  • Like this: wordpress.stackexchange.com/a/130425/73
    – fuxia
    Nov 3, 2014 at 12:38
  • So I guess the point is to include editor_js and enqueue_scripts functions? My plugin is procedural, is there any way i can just add these procedurally to my ajax request function? Nov 3, 2014 at 12:52
  • Sure, it is the same code, just without the objects.
    – fuxia
    Nov 3, 2014 at 13:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.