Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#18150 closed defect (bug) (duplicate)

languages files for tinymce external plugin don't work properly in the theme files

Reported by: kaptinlin's profile kaptinlin Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: TinyMCE Keywords: has-patch dev-feedback
Focuses: Cc:


When adding a external tinymce plugin by using mce_external_plugins hook in the theme's function.php file

It will not load language files in TINYMCE_PLUGIN_PATH/langs/ folder.

Then i look into the code of \wp-admin\includes\post.php file.

In line 1498 of version 3.2.1

The code is below

$path = str_replace( WP_PLUGIN_URL, '', $plugurl );
$path = WP_PLUGIN_DIR . $path . '/langs/';

It just replace the url of plugin folder with the real path.

When you echo the $path , you will see


The correct one should be


So i add some code to fix it. Just replace the line 1498-1499 of \wp-admin\includes\post.php (version 3.2.1) with the code below.

if(false !== strpos($plugurl, WP_PLUGIN_URL)){
		$path = str_replace( WP_PLUGIN_URL, '', $plugurl );
		$path = WP_PLUGIN_DIR . $path . '/langs/';
		$path = str_replace( get_template_directory_uri(), '', $plugurl );
		$path =  get_template_directory(). $path . '/langs/';

It works perfect.

Attachments (2) (16.4 KB) - added by kaptinlin 12 years ago.
post.php (60.4 KB) - added by kaptinlin 12 years ago.

Download all attachments as: .zip

Change History (3)

12 years ago

12 years ago


#1 @azaozz
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Yes, the current code expects that extra TinyMCE plugins are added from wp-content/plugins. Currently I'm refactoring this and will switch it to look in wp-content directory instead.

Closing this as duplicate of #17144 as it should be handled there.

Note: See TracTickets for help on using tickets.