How to load wp_editor via AJAX

The main problem are the missing scripts. The scripts enqueued in _WP_Editors::enqueue_scripts() are never printed. The same is true for _WP_Editors::editor_js(). So you have to do that in your AJAX callback handler. I have written a demo plugin and put it on GitHub: T5 AJAX Editor. There is one class named Ajax_Editor. Its method render() … Read more

wp_editor textarea value not updating

tinyMCE <textarea> element is initially unseen by the used serialize function: $.post( ajaxurl, $(‘#addtag’).serialize(), function(r) { // Content here. } }); You will need to call tinyMCE.triggerSave() to make it visible. Below is a simple snippet that should do the trick: jQuery(‘#submit’).mousedown( function() { tinyMCE.triggerSave(); }); This in an external file, enqueued with wp_enqueue_script(); it … Read more

Creating a wp_editor instance with custom tinyMCE buttons

You pretty much had it, according to the description. Here’s what you might be looking for for instances 2 and 3 (for instance 1 you can leave the settings empty to get the default set of buttons): Instance 2: wp_editor( $distribution, ‘distribution’, array( ‘media_buttons’ => false, ‘textarea_rows’ => 8, ‘tabindex’ => 4, ‘tinymce’ => array( … Read more

How to load wp_editor() through AJAX/jQuery

To get the quicktags to show up, you need to re instantiate them within your ajax oncomplete handler. quicktags({id : ‘editorcontentid’}); My ajax success handler looks like this; success: function(data, textStatus, XMLHttpRequest){ //append editor to dom $(‘#container’).append($(data).html()); //init quicktags quicktags({id : ‘editorcontentid’}); //init tinymce tinymce.init(tinyMCEPreInit.mceInit[‘editorcontentid’]); } I’ve managed to get the editor to load by … Read more

Adding Custom Text Patterns in the WP 4.5 Visual Editor

Here’s a way to test the core patch #33300.6 by Andew Ozz, through a test plugin in WP 4.5.2, to try out the text pattern filter. Demo Here’s a strikethrough example using ~ $init[‘wpsetextpattern_inline_patterns’] = ‘{ strong: { start: “*”, end: “*”, format: “bold” }, strong2: { start: “**”, end: “**”, format: “bold” }, em: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)