The login_display_language_dropdown WordPress PHP Filter allows you to control the display of the language dropdown on the login screen.
Usage
add_filter('login_display_language_dropdown', 'your_custom_function'); function your_custom_function($display_language_dropdown) { // your custom code here return $display_language_dropdown; }
Parameters
$display_language_dropdown
(bool) – Determines whether to display the language dropdown on the login screen.
More information
See WordPress Developer Resources: login_display_language_dropdown
Examples
Hide the language dropdown
To hide the language dropdown on the login screen, return false
from your custom function.
add_filter('login_display_language_dropdown', 'hide_language_dropdown'); function hide_language_dropdown($display_language_dropdown) { return false; }
Show the language dropdown
To display the language dropdown on the login screen, return true
from your custom function.
add_filter('login_display_language_dropdown', 'show_language_dropdown'); function show_language_dropdown($display_language_dropdown) { return true; }
Display the language dropdown based on user role
To display the language dropdown on the login screen for users with the ‘editor’ role, use the following code:
add_filter('login_display_language_dropdown', 'display_language_dropdown_for_editors'); function display_language_dropdown_for_editors($display_language_dropdown) { if (current_user_can('editor')) { return true; } return false; }
Display the language dropdown for specific IP addresses
To show the language dropdown only for specific IP addresses, use the following code:
add_filter('login_display_language_dropdown', 'display_language_dropdown_for_ips'); function display_language_dropdown_for_ips($display_language_dropdown) { $allowed_ips = array('192.168.1.1', '192.168.1.2'); if (in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) { return true; } return false; }
Display the language dropdown based on a custom condition
To display the language dropdown on the login screen based on a custom condition (e.g., a specific day of the week), use the following code:
add_filter('login_display_language_dropdown', 'display_language_dropdown_on_specific_day'); function display_language_dropdown_on_specific_day($display_language_dropdown) { $day_of_week = date('l'); if ($day_of_week === 'Monday') { return true; } return false; }