[wp-trac] [WordPress Trac] #28403: Multiple wp_editor's with different settings

WordPress Trac noreply at wordpress.org
Fri May 30 09:25:15 UTC 2014


#28403: Multiple wp_editor's with different settings
--------------------------+-----------------------------
 Reporter:  madeinua      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  3.9.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello,

 I found a bug in when using multiple wp_editor's with different settings.

 Sample:

 {{{
 wp_editor('', 'field_1', array(
  'textarea_name' => 'field_1',
  'tinymce'       => true,
  'default_editor' => 'tinymce'
  )
 );

 wp_editor('', 'field_2', array(
  'textarea_name' => 'field_2',
  'tinymce'       => false,
  'default_editor' => 'html'
  )
 );
 }}}

 Result: I see tinymce editor for 2nd editor
 Excepted result: should be html editor for 2nd editor

 Conjecture:

 you have the following code in WP:

 {{{
 if ( 'html' === $default_editor ) {
   add_filter('the_editor_content', 'wp_htmledit_pre');
   $switch_class = 'html-active';
 } else {
   add_filter('the_editor_content', 'wp_richedit_pre');
   $switch_class = 'tmce-active';
 }
 }}}

 For the first editor (field_1) system creates filter
 add_filter('the_editor_content', 'wp_richedit_pre');

 but we don't need it for the 2nd editor (field_2). But he has already been
 initialized and will be applied for both editors when calling
 apply_filter('the_editor_content',...). So, please apply filters only to
 necessary editors which have related settings, not to everyone.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28403>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list