How to Set a Specific Language in WP Ghost – Plugin Translation Guide
November 8, 2024
This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.
Quick summary: Display WP Ghost in a specific language using the Built-in Plugin Translations toggle in WP Ghost > Advanced > Compatibility, or force a specific locale by adding a plugin_locale filter in a must-use plugin. Both methods only affect WP Ghost – your dashboard and other plugins stay in their own language.
Why set a specific language for WP Ghost
By default, WP Ghost displays in your WordPress dashboard language if a translation is available. Two common scenarios require changing this. First, you want WP Ghost to use its own bundled translations instead of the global WordPress language pack (which may be outdated or incomplete). Second, your dashboard is in one language but you prefer WP Ghost’s interface in another, like running a French dashboard but reading security settings in English.
WP Ghost supports both scenarios with two different methods.
| Method | Best For | Code Required |
|---|---|---|
| Built-in Plugin Translations (dashboard) | Using WP Ghost’s latest bundled translations | No |
| plugin_locale filter (must-use plugin) | Forcing a specific language different from your dashboard | Yes |
Method 1: Built-in Plugin Translations (no code)
WP Ghost ships with bundled translation files for several languages. By default, WordPress checks the global wp-content/languages directory first. The Built-in Plugin Translations option reverses this priority so WP Ghost loads its own translations first.
1. Go to WP Ghost > Advanced > Compatibility.
2. Find the Built-in Plugin Translations option.
3. Toggle it ON.
4. Click Save.
WP Ghost now loads translations from its own languages folder. You get the translation strings that ship with the plugin version you are running. Besides English, the current version ships translations for Arabic, Chinese (Simplified), Dutch, Finnish, French, German, Indonesian, Italian, Japanese, Portuguese (Brazil and Portugal), Romanian, Russian, Spanish and Turkish.
Use this method when your dashboard language does not match WP Ghost’s translation, when WP Ghost shows partially translated text, or when you want the latest translations shipped with the plugin.
Method 2: Force a specific language with a must-use plugin
If you want WP Ghost to display in a specific language that is different from your WordPress dashboard language, use the plugin_locale filter. For example, your site is in French but you prefer reading WP Ghost settings in English. Put the filter in a must-use plugin or your child theme’s functions.php, not in wp-config.php: that file runs before WordPress loads add_filter(), and the site stops with a fatal error.
Add the filter code
1. In WP Ghost > Advanced > Compatibility, switch off Built-in Plugin Translations and save. While it’s on, WP Ghost loads its bundled translation file directly and skips this filter.
2. With your hosting File Manager or an FTP client, create a file named wpghost-language.php in wp-content/mu-plugins/ (create the folder if needed).
3. Add the following code to the file:
<?php
add_filter( 'plugin_locale', function ( $locale, $plugin ) {
if ( $plugin === 'hide-my-wp' ) {
return 'en_US'; // Forces WP Ghost to use the en_US locale
}
return $locale;
}, 11, 2 );4. Save the file. If you used FTP, upload it to wp-content/mu-plugins/. WordPress loads must-use plugins on its own, so there is nothing to activate.
5. Refresh your WordPress dashboard. WP Ghost now displays in the language you specified.
Important: If a typo in the new file takes the site down, delete the file over FTP and the site comes back.
To use a different language, replace en_US with your preferred locale code. For example, fr_FR for French, de_DE for German, or es_ES for Spanish.
Common locale codes
WordPress locale codes follow the format language_COUNTRY. Here are the codes for the languages WP Ghost currently supports:
| Language | Locale Code |
|---|---|
| English (US) | en_US |
| French | fr_FR |
| German | de_DE |
| Spanish | es_ES |
| Italian | it_IT |
| Portuguese (Brazil) | pt_BR |
| Dutch | nl_NL |
| Romanian | ro_RO |
| Russian | ru_RU |
| Turkish | tr_TR |
| Indonesian | id_ID |
If your language is not in this list, you can still use its locale code, but WP Ghost will fall back to English if no translation is available. To contribute a translation for your language, visit the WP Ghost translation project on WordPress.org.
Frequently asked questions
Which method should I use?
Use the built-in Plugin Translations option if you want WP Ghost to use its own bundled translations in your dashboard’s language. Use the must-use plugin method if you want to force WP Ghost into a specific language that is different from your dashboard. The built-in option does not change the language itself – it changes which translation files are loaded first.
Will this affect my dashboard or other plugins?
No. Both methods only affect WP Ghost. Your WordPress dashboard, other plugins, and your site frontend remain in their configured language. The plugin_locale filter checks specifically for the hide-my-wp plugin slug and only modifies that plugin’s locale.
My language is not supported. Can I still use it?
You can use any WordPress locale code in the must-use plugin method, but if WP Ghost does not have a translation for that language, the interface will fall back to English. You can contribute a translation through the WordPress.org translation platform.
How do I undo the language change?
For the built-in option, toggle it off in WP Ghost > Advanced > Compatibility and save. For the must-use plugin method, delete wpghost-language.php from wp-content/mu-plugins/. WP Ghost will return to using your dashboard’s language.
Does WP Ghost modify WordPress core files?
No. WP Ghost never modifies core files. The must-use plugin method adds one file of your own in wp-content/mu-plugins/, which WordPress does not touch during updates.
Related tutorials
For more WP Ghost customization options:
Advanced WP Security – All advanced settings in WP Ghost including the Plugin Translations toggle.
Customize Paths in WP Ghost – Main path security configuration guide.
Preset Security Options – One-click security configurations for fast setup.
Install WP Ghost Plugin – Step-by-step installation guide.
Disable WP Ghost in Case of Error – Emergency recovery steps.