Login Page Language Switcher in WordPress 5.9
Since WordPress 4.9, it’s possible to control the language of the login screen using the wp_lang query variable (example: wp-login.php?wp_lang=fr_FR).
This is a hidden feature that was only used by the interim login modal.
The update of WordPress 5.9 has introduced a new login Page language switcher feature.
This language switcher dropdown allows users to use the login screen, the password reset screen, and the registration screen in their own language.
Filters Default Arguments For The Languages Dropdown
Please note that the language list in the dropdown is based on the currently installed languages of the WordPress installation. To install a new language, websites administrators can use the language selector available on Settings > General.
Go to the site languages drop-down, select a language to install and save changes. This installs and switches the site language, you can switch back if you do not want that as the default language.
On a website with several languages installed, only show fr_FR and de_DE in the dropdown
Add specific languages in the dropdown Usage example:
function loginpress_filter_login_language_dropdown_args( $args ) {
$args['languages'] = array( 'fr_FR', 'de_DE' );
return $args;
}
add_filter( 'login_language_dropdown_args', 'loginpress_filter_login_language_dropdown_args', 10, 1 );
Remove The Language Dropdown Entirely
If you want to remove the Language dropdown entirely, you can use the login_display_language_dropdown filter.
Remove dropdown Usage example:
add_filter( 'login_display_language_dropdown', '__return_false' );
Usage in LoginPress:
LoginPress has adapted the login page language switcher in version 1.5.11 so the user can customize it accordingly.
LoginPress is providing the feature to allow the admin of the site to control the availability of language switchers to the general public on the login screen.
That’s all! You can also check out How to Find the WordPress Login URL (Easy Guide) and How to Easily Change the Login Logo in WordPress.
Not using LoginPress yet? What are you waiting for?