This question already has an answer here:

Basically if I call wp_editor via ajax it acts funny, I noticed it does not include 2 scripts it DOES include if i call it normally within a form (NOT thru ajax). I found some anwers like tinemce needs to be reinitialized and whatnot so that WP would call again the necessary scripts, but I can't figure it out.

My ajax call:

            type: "POST",
            async: true,
            url: vkrwps_admin.ajax_url,
            data: {
                action: 'EDIT_PROD',
                sv: sv,
                preload: vkrwps_admin.preloader
            cache: false,
            beforeSend: function() {
            success: function(response){
                var r = (new Date()).getTime();

                $('div.mule').html(response).find('img').prop('src', function(_, src) {
                     return src + '?v=' + r;
                // call chosen on select
                    // placeholder_text: "Choose a product..."
                    'disable_search': true

                // $('select.dropsearch').val(4).trigger('change');
            complete: function() {
                // $('select.dropsearch').one().val(cf).trigger('change');

From what I found here: How to load wp_editor() through AJAX/jQuery I tried putting the following on top of my script that has the ajax call in it:

$.fn.tinymce_textareas = function(){
    skin : "wp_theme"
    // other options here

and then I changed my success to:


But then I get an error:

ReferenceError: tinyMCE is not defined

How do I make WP call the necessary scripts?

marked as duplicate by Tom J Nowell Apr 1 '14 at 10:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I think this is a tinyMCE issue you need to pass a selector parameter and therefore off-topic. However, I've been working on dynamic tinymce editors for the past 2 days (so I'm fairly certain you need to pass a selector parameter. My WP Alchemy Grail theme has dynamically (not ajax) added editors that might point you in the right direction. I have some WP3.9 code I'm going to push to a branch as soon as I can get my git client to cooperate. – helgatheviking Apr 1 '14 at 22:09

Browse other questions tagged or ask your own question.