help on wp_editor via ajax load [duplicate]

I’m not good with English, but the answer is that the editor class calls the scripts needed in the admin footer (wp-includes/class-wp-editor.php line 160) :

add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js'), 50 );
add_action( 'admin_footer', array( __CLASS__, 'enqueue_scripts'), 1 );

So when you call the wp_editor function in your ajax, the scripts aren’t printed with it, so you need to call them in your ajax with :

wp_editor('coool', 'editor_id');
do_action('admin_footer', '');
do_action('admin_print_footer_scripts');

This definitely works but it may not work as you want because you call all the wp admin footer so the perfect solution is to call only the scripts needed and this may take some time, I’ll post the code as soon as possible, but try the code above I think it gives you an idea about what I talking about.

Leave a Comment