Categories
Tech

Getting GTranslate to Work with WordPress and HTTPS

I installed GTranslate on my blog (the one you’re reading!) not long ago and noticed a strange problem I was having with settings not being saved and the plug-in not showing up as a widget on the home page when it was activated.
If you have the same problem, you will notice the “Configure it from WP-Admin -> Settings -> GTranslate to see it in action” showing up in your widget bar.

This was on GTranslate version 1.0.23 and WordPress version 3.1.3 (both the latest as of this post… although I don’t think the WordPress installation is the problem here… read on!)
I also tried it on a fresh installation of WordPress 3.1.3 to rule out any other configuration/plug-in changes.

I did a bit of investigative work and found out that this was due to my Admin control panel using HTTPS.
GTranslate doesn’t like HTTPS and although it may seem like it’s updating your settings when you click ‘Save Changes’, it actually isn’t doing a thing 🙂

I believe the problem lies with the way GTranslate POSTs the ‘Save Changes’ request. It looks like it simply assumes that the protocol being used is HTTP and sends requests using that protocol.
The problem with that is sites using HTTPS will not be able to process those URLs as they are formatted as HTTP and not HTTPS. This causes WordPress to 302 (temporary re-direct) back to HTTPS and not save the settings.

A work around for this problem is to disable HTTPS temporarily (very easy) on your WordPress Admin pages, save any GTranslate settings that need saving and then re-enable HTTPS.

You can disable HTTPS by setting the following parameter in the wp-config.php file to false

  define('FORCE_SSL_ADMIN', false);

After you have saved the GTranslate settings, you can safely set the FORCE_SSL_ADMIN variable back to true to re-enable SSL on your Admin pages.

Edit: After reporting this to the author of the plug-in via e-mail, this has now been fixed in GTranslate version 1.0.26… please update your plug-in if you are having any issues with SSL!