Skip Navigation

Resolved

Overview of the issue

Some hosting providers, like Pantheon, have very strict security and follow the best recommended practices for deploying a WordPress sites.
These hosting providers secure their instances and allow write permissions by the web server to only the uploads folder.
If you are using such hosting provider, then the new method of translating with String Translation, will create issues for you – because the server itself and WPML String Translation will not be allowed to write in the folder /wp-content/languages/ and the folders in the folder tree beneath that.

Workaround

To fix the issue and have everything working, you should re-define the folder for languages of WordPress (normally located in /wp-content/languages/ )

For Pantheon hosting, you can do that by adding this code to wp-config.php

define( 'WP_LANG_DIR', $_SERVER['HOME'] .'/files/languages' );

We suggest to add this code after:

    /** Define appropriate location for default tmp directory on Pantheon */
    define('WP_TEMP_DIR', $_SERVER['HOME'] .'/tmp');

You can try then to go to Dashboard > Updates and run the WordPress logic to get all language packs by pressing the button “Update Translations”

It was reported to us that it is possible that you also might need to create the /languages/ folder and /languages/wpml/ folders manually before everything works properly (if they were not created).

12 Responses to “Hosting with read-only folder /wp-content/languages/ issues with WPML String Translation”

  1. I have tested this on Pantheon and it does not work. I followed the steps and still receive the same error as before. I also am noticing that the troubleshooting button doesn’t launch the dialog.

  2. I think a key step is missing here in your documentation. You need to manually create these directories in the uploads folder on each environment in order for this to work.

    • Hello!
      Did you manage to resolve the problem by creating the folders manually?
      We can add that step if you confirm.

      As far as I know, WPML latest versions should be able to create the folders automatically once you run the logic from WPML > Theme and Plugin Localizations page.

      • Hello George,

        I am having the same problem and talked with Laura from support. And the solution did not work.. Laura told me to back u the site and then clear WPML cacher again. And now I am backing up my whole site and will clear the cache of WPML But until now the solutions does not seem to work.

  3. Hello again,

    I was able to solve the issue with the hosting company.
    It was a simple path problem in wp-config.php

    define( ‘WP_LANG_DIR’, $_SERVER[‘HOME’] .’/files/languages/wpml’ );

    I changed the path ‘/files/languages/wpml’ to FULL home directory path and WPML was able to generate .MO files

    • I do have the same issues and the offered solutions do not work – very frustrating.
      What do you mean with “changed the path to full home directory path? Does it mean that you put it at the same level as wp-content?

      • Hello, Nicole!

        As far as I understand, the previous commenter here changed and used

        $_SERVER["HOME"]

        but for PHP 7.x instead you should probably use

        $_SERVER["DOCUMENT_ROOT"]

        The variable returns the FULL path to the directory where your WordPress is installed.
        It might be something like:

        /home/user/www/

        So, to answer your question – yes, you have to put the full absolute path to a folder – it can be wp-content, where your WordPress can write – usually that is the wp-content/uploads/ folder, however your mileage may vary and for your setup it could be a different folder and absolute path.

        And the absolute path depends on your hosting setup and your username/server configuration.

        If you open a ticket in our forum, we should be able to help you with this further.

  4. Hello,
    In our case I am able to write in to wp-content/languages/wpml/ with a simple test php script executed trough web, but WPML is displaying error: WPML String Translation is attempting to write .mo files with translations to folder.
    I even set the folder permissions to 777, but that didn’t help.
    The folder path from the error is correct, does exist and it is possible to write files with the php user.