WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#19648 closed defect (bug) (fixed)

mce_external_languages/plugins prints twice

Reported by: Cyapow Owned by: duck_
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.3
Component: TinyMCE Keywords: has-patch
Focuses: Cc:

Description

When adding a language using the 'mce_external_languages' filter the contents get printed for each external plugin loaded.

to fix wp-includes/class.wp-editor.php line 210 add

self::$ext_plugins .= $ext_plugins;

same file line 212 add

$ext_plugins = '';

(first one goes before the foreach loop and the second goes at the beginning of the loop)

Attachments (2)

19648.patch (538 bytes) - added by SergeyBiryukov 4 years ago.
class-wp-editor.php.patch (1.6 KB) - added by azaozz 3 years ago.
Almost the same as 20030.diff and 19648.patch but keep self::$ext_plugins .= $ext_plugins; in the code block that runs only once per load.

Download all attachments as: .zip

Change History (6)

@SergeyBiryukov4 years ago

comment:1 @SergeyBiryukov4 years ago

  • Keywords has-patch added

comment:2 @SergeyBiryukov3 years ago

  • Milestone changed from Awaiting Review to 3.4

comment:3 @duck_3 years ago

  • Summary changed from mce_external_languages prints twice to mce_external_languages/plugins prints twice

Also: #20030 and 20030.diff

Bug can be replicated for external plugins with:

function trac20030_mce_external_plugins( $plugins ) {
   $plugins['myplugin1'] = WP_PLUGIN_URL . '/myplugin1.js';
   $plugins['myplugin2'] = WP_PLUGIN_URL . '/myplugin2.js';
   return $plugins;
}
add_filter( 'mce_external_plugins', 'trac20030_mce_external_plugins' );

@azaozz3 years ago

Almost the same as 20030.diff and 19648.patch but keep self::$ext_plugins .= $ext_plugins; in the code block that runs only once per load.

comment:4 @duck_3 years ago

  • Owner set to duck_
  • Resolution set to fixed
  • Status changed from new to closed

In [19913]:

Stop WP_Editor from outputting TinyMCE external plugins/languages multiple times. Props Cyapow. Fixes #19648.

Note: See TracTickets for help on using tickets.