login_language_dropdown_args is a WordPress PHP filter that allows you to modify the default arguments for the language selection dropdown on the login screen.
Usage
add_filter('login_language_dropdown_args', 'your_custom_function'); function your_custom_function($args) { // your custom code here return $args; }
Parameters
- $args (array): The array of arguments for the language selection dropdown on the login screen.
More information
See WordPress Developer Resources: login_language_dropdown_args
Examples
Set default language to Spanish
To set the default language to Spanish, modify the ‘selected’ argument:
add_filter('login_language_dropdown_args', 'set_default_language_to_spanish'); function set_default_language_to_spanish($args) { $args['selected'] = 'es_ES'; return $args; }
Show only specific languages
To show only specific languages in the dropdown, modify the ‘languages’ argument:
add_filter('login_language_dropdown_args', 'show_specific_languages'); function show_specific_languages($args) { $args['languages'] = array('en_US', 'es_ES', 'fr_FR'); return $args; }
Change the language dropdown label
To change the label of the language dropdown, modify the ‘show_option_none’ argument:
add_filter('login_language_dropdown_args', 'change_language_dropdown_label'); function change_language_dropdown_label($args) { $args['show_option_none'] = 'Choose your language'; return $args; }
Remove the “Site Default” option
To remove the “Site Default” option from the language dropdown, modify the ‘show_option_site_default’ argument:
add_filter('login_language_dropdown_args', 'remove_site_default_option'); function remove_site_default_option($args) { $args['show_option_site_default'] = false; return $args; }
Display language names in their native language
To display language names in their native language, modify the ‘display_names’ argument:
add_filter('login_language_dropdown_args', 'display_native_language_names'); function display_native_language_names($args) { $args['display_names'] = true; return $args; }