Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save andysdesigns/bb9a687fb395d51f4f121d771a739da0 to your computer and use it in GitHub Desktop.

Select an option

Save andysdesigns/bb9a687fb395d51f4f121d771a739da0 to your computer and use it in GitHub Desktop.
wp_editor() using AJAX
jQuery.ajax({
url : '<?php echo admin_url('admin-ajax.php'); ?>',
data : { product_cat: category , action : 'newproduct_form'},
method : 'post',
success : function(form){
if (form != 0) {
// remove existing editor instance
tinymce.execCommand('mceRemoveEditor', true, 'post_content');
// init editor for newly appended div
var init = tinymce.extend( {}, tinyMCEPreInit.mceInit[ 'post_content' ] );
try { tinymce.init( init ); } catch(e){}
}
}
});
// Article : http://shyammakwana.me/wordpress/wordpress-load-wp_editor-ajaxjquery.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment