Loading wp_editor through wordpress ajax not working (5 posts)

  1. macpraveen
    Posted 3 years ago #

    I am trying to load wp editor (through wp_editor() function) using wordpress admin ajax inside a jquery tab for my plugin.

    But the editor is not displayed properly. No icons but visual/html tabs and media upload works.

    I see that wp loads some js for tinymce in footer when loaded normally without ajax. But how to do the same when loaded via ajax?


  2. polaris1
    Posted 3 years ago #

    Hi Macpraveen,

    I am working on something similar and I noticed that in order for the icons to display properly the editor needs to be passed a unique id when you call it.

    It seems like you might have an answer to a related question I have -- I would like to fetch a wp editor on demand using ajax, but all I can seem to do with wp_editor() is echo the editor, not put it into a string to send to my javascript. How are you fetching an editor using ajax?

    This is what isn't working:

    function addquestionanswerbox() {
    		$boxHTML+= "<h2>Question {($number+1)} :</h2>";
    		$boxHTML+= wp_editor( $question_c , "qaeditorq{($number+1)}", array('textarea_name'=>"qa_question[]") );
    		$boxHTML+= "<h2>Answer{($number+1)} :</h2>";
    		$boxHTML+= wp_editor( $answer_c , "qaeditora{($number+1)}", array('textarea_name'=>"qa_answer[]") );   

    I would love to hear how you did this!


  3. polaris1
    Posted 3 years ago #

    Sorry, I should have been more specific about the answer to your question:

    wp_editor("" , "uniqueid", array('textarea_name'=>"textareaname") );

    should produce a functioning editor with nothing in it.

  4. bsieders
    Posted 3 years ago #

    Hi guys,

    Sorry to bump this question but I am also looking for the exact same solution. I tried loading the wp_editor via ajax and just get a half arsed textarea instead.

    Anybody else know if there is a way?


  5. ridwan developer
    Posted 3 years ago #

    Hi all,

    I'm having problem with loading the_editor via ajax. is there any solution?

Topic Closed

This topic has been closed to new replies.

About this Topic