Organizational Research By

Surprising Reserch Topic

dynamically generated wordpress wysiwyg editor wp editor not displaying prop

dynamically generated wordpress wysiwyg editor wp editor not displaying prop  using -'php,ajax,wordpress,tinymce,wordpress-plugin-dev'

I have 2 html wysiwyg editors on a wordpress admin page. Both use WP_EDITOR() function. The first one is hard coded into the page:

<form name="form1" id="form1" method="post" action="" style="display:block;">
    <!-- editor here -->
       wp_editor( 'CONTENT WILL APPEAR HERE!', 'addsometxt', array('textarea_name'=>'create_txt','textarea_rows'=>10,'wpautop'=>false));
   <input name="save" type="submit" class="button-primary" id="save" style="margin:5px;" value="Save Input" /></p>

The second one is generated dynamically with a PHP function using an AJAX call (wp_ajax_ and $.post). I've test the ajax call and know it works; so, for brevity, here's the php function:

function display_editor2() {
// grab data from database (data_from_db) and display in editor
  wp_editor( $row->data_from_db, 'editsometxt', array('textarea_name'=>'edit_txt','textarea_rows'=>10,'wpautop'=>false));


The problem is that even though the 2nd editor is displaying; it's missing all the tool bar buttons. See image below for illustration. Anyone know who to fix this?


asked Oct 13, 2015 by mca.agarwal
0 votes

Related Hot Questions

3 Answers

0 votes

Probably you need to add media_buttons and tinymce parameter on your AJAX call.

Something like this:

data_from_db, 'editsometxt', array('textarea_name'=>'edit_txt','media_buttons'=>true,'tinymce'=>true,'textarea_rows'=>10,'wpautop'=>false));


I recommend you check wp_editor() Function Reference page at Wordpress Codex.

answered Oct 13, 2015 by akasati02
0 votes

Hey I too had the same problem!

I just deactivated all the plug-ins which are installed by me and refreshed the page, and then I tried to edit the post/pages in the visual area also. Check once it will work for you. :)

answered Oct 13, 2015 by ashishshukla
0 votes

I hade the same problem, using this:

By passing a ID (second parameter to wp_editor) I got the buttons. Like this:

answered Oct 13, 2015 by gauravsinghal83