WordPress – Global Translator Plugin Fix

wordpress-4-1Global Translator is a free and open source WordPress Plugin which is able to automatically translate your blog into different languages. After activating the Global Translator plugin, it is displayed under the Admin Settings as Global Translator. However, the link is incorrect and will not display. The link selects an absolute path that is incorrect. https://it.megocollector.com/wp-admin/:/…/it/wp-content/plugins/global-translator/options-translator.php The plugin is still functional though not accessible through this menu. Looking through the code of other plugins that were also available in Settings, I found a piece of simple code that worked and with little modification to the Global Translator plugin, the plugin is now accessible and functional through the Admin Settings. To correct this, edit the translator.php file.

I don’t know if this is a widespread problem. It is at least with my installations both in production and in the test environment. I have verified this at least in the 2.5.x and 2.6.x releases of WordPress and with Global Translator versions 0.9.x through 1.0.6. This would seem like something that would have been identified and corrected if this were widespread. I don’t know why it wouldn’t be. Anyway, the following change works for me, hopefully someone else too.

translator.php original code

function gltr_add_options_page()
{
$path = dirname(__file__);
$pos = strrpos($path, '/') + 1;
$option_file = substr($path, $pos) . '/options-translator.php';
add_options_page('Global Translator Options', 'Global Translator', 8, $option_file);
}

translator.php corrected code

function gltr_add_options_page()
{
if (function_exists('add_options_page')) {
add_options_page(__('Global Translator', 'translator'), __('Global Translator', 'translator'), 'manage_options', 'global-translator/options-translator.php') ;
}
}

Update: After making the change, I updated a post and received many error messages relating to this plugin cache;.  I deleted all the cache for Global Translator and all seems to be functioning without error.