Support » Developing with WordPress » WP_Editor not working via Ajax Dialogue window

  • I have created this video to make it more obvious: https://www.youtube.com/watch?v=p7isEgXf9To

    I am wishing to use wp_editor in my own plugins creation to avoid having multiple instances of an html editor in WordPress and instead, take advantage of what is built in.

    I succeed in executing this snippet inside my plugins home page within WordPress

    <?
    $settings = array(
         // note that spaces in this list seem to cause an issue
    	'quicktags' => array( 'buttons' => 'strong,em,del,ul,ol,li,close' ),
        'media_buttons' => false
    );
        wp_editor("mary had a little lamb","testtwo",$settings);
    ?>
    

    However, when I use that very same piece of code in an Ajax dialog window it fails.

    Was wondering if one of your experts might tell me how to resolve this issue.

    Sincerely,

    Jay
    CompuMatter

Viewing 2 replies - 1 through 2 (of 2 total)
  • can you post the full ajax code you are using to call the wp_editor part ?

    “wp_editor()” function implicitly enqueues “wp-admin/js/editor.js” when called from an non-ajax page (pageload).

    In your case, I think the editor.js is not enqueued properly.
    You can also enqueue the “editor.js” explicitly by calling “wp_enqueue_editor()” function. see this

    The editor can be initialized when needed after page load. See wp.editor.initialize() in wp-admin/js/editor.js for initialization options.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.