Wordpress is awesome, but there is something that is driving me crazy.

Whenever a plugin or a theme is updated, all files are deleted and replaced. So if I have custom code or a translation in one plugin, it will get lost!

I've seen some solutions suggesting to change the textdomain of the plugin to load language files from wp-content/languages, but if I write a custom function to load the *.po and *.mo from wp-content, directly in the plugin code, it will get overwritten too.

So I was wondering how I can update my plugins, without losing the translation or the custom code.

I ended up with WPML strings that do the job, by saving translation in DB, ( I'm not sure if is the way) but WPML is a very heavy plugin, and I will have to install it in all sites, which makes it difficult to maintain.

Is there any function to overwrite all textdomains of a plugin, so I can have all of the translations in wp-content/languages, without changing plugin code?

  • 1
    As starting point, always backup the translations you do. Second, send them to the plugin/theme author, high probability of getting them included in the next releases. Related: [1] + [2] + [3].
    – brasofilo
    Commented Feb 16, 2013 at 21:52
  • custom translation.
    – André
    Commented Feb 17, 2013 at 1:20
  • some plugins like woocommerce are enabled to read wp-content/languages/woocommerce/ mo and po files default so translations won't be overwiten. Also since 3.5 translation of themes by default from wp-content, but plugins not yet. core.trac.wordpress.org/ticket/18200#comment:43
    – André
    Commented Feb 17, 2013 at 6:58
  • Would the core of your Question be: "How to prevent themes/plugins that don't work with /wp-content/languages to load their language files and force them to load my own files" ?
    – brasofilo
    Commented Feb 17, 2013 at 7:09
  • well done! sure it is
    – André
    Commented Feb 17, 2013 at 8:39

1 Answer 1


Here is a patch for 3.5 to use this with plugins.
Use wp-content/languages/plugins/textdomain-pt_BR.po

Apply this via SSH with: patch -p1 < no_plugin_overwrite.patch
Hopefully its gonna be released in 3.6.

Ticket #18200 (new task (blessed))

Implement language packs for core, plugins, and themes.

  • Eu sabia! André com acento no é ;) - Great to know this is a core candidate, I like this string in the patch: 'Some of your language files need updating, Sit tight for a few more seconds while we update them as well.'
    – brasofilo
    Commented Feb 17, 2013 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.