When managing a WordPress site, prioritizing security is paramount. Safeguarding your website’s integrity and data integrity begins with implementing robust security measures. Ensuring the security and customization of your website’s login screen is crucial. In this guide, I’ll walk you through step-by-step on how to remove the Password Reset option, “Lost your password?” link, Remember Me checkbox, and how to hide the WordPress version. These tweaks not only enhance security but also provide a more streamlined and professional user experience.
Go from this:
to this:
Before we begin, if you just want the code to paste in your functions.php file instead of reading this article, just copy and paste the below code in your theme’s function.php file:
// Disable password reset
function disable_password_reset() {
return false;
}
add_filter('allow_password_reset', 'disable_password_reset');
// Remove lost password text
function remove_lostpassword_text($text) {
if ($text == 'Lost your password?') {
$text = '';
}
return $text;
}
add_filter('gettext', 'remove_lostpassword_text');
// Hide WordPress version
remove_action('wp_head', 'wp_generator');
// Remove "Remember Me" checkbox
add_action('login_enqueue_scripts', 'remove_remember_me');
function remove_remember_me() {
echo '<style>.login form p.forgetmenot {display: none;}</style>';
}
After pasting it in the file, just click on the Update File button in the WordPress Edit Themes area.
Need to know how to get to the functions.php file? Follow the below instructions:
- Log in to your WordPress admin area.
- Navigate to Appearance > Theme Editor from the left-hand sidebar.
- On the right-hand side, locate and click on
functions.php
under your currently active theme.
Why Customize the WordPress Login Screen?
Customizing the WordPress login screen offers several advantages:
- Enhanced Security: By removing unnecessary features like password reset and hiding the WordPress version, you reduce potential attack vectors for malicious actors.
- Improved User Experience: Simplifying the login interface can make it easier and faster for users to access their accounts.
- Brand Consistency: Customizing elements like the login screen helps in maintaining a consistent brand experience throughout your website.
Removing Password Reset Option
WordPress by default allows users to reset their passwords easily. However, in some cases, you may want to disable this feature altogether.
<?php
// Disable password reset
function disable_password_reset() {
return false;
}
add_filter('allow_password_reset', 'disable_password_reset');
?>
How It Works:
- Function Explanation: The
disable_password_reset
function uses theallow_password_reset
filter to returnfalse
, effectively disabling the password reset option.
Removing “Lost your password?” Link
The “Lost your password?” link can be removed to streamline the login screen further.
<?php
// Remove "Lost your password?" text
function remove_lostpassword_text($text) {
if ($text == 'Lost your password?') {
$text = '';
}
return $text;
}
add_filter('gettext', 'remove_lostpassword_text');
?>
How It Works:
- Filter Explanation: The
remove_lostpassword_text
function modifies thegettext
filter to replace the “Lost your password?” text with an empty string, effectively hiding the link.
Removing Remember Me Checkbox
The “Remember Me” checkbox can be removed to eliminate the option of persistent login sessions.
<?php
// Remove "Remember Me" checkbox
add_action('login_enqueue_scripts', 'remove_remember_me');
function remove_remember_me() {
echo '<style>.login form p.forgetmenot {display: none;}</style>';
}
?>
How It Works:
- CSS Technique: This function uses CSS to hide the
<p>
element that contains the “Remember Me” checkbox on the WordPress login form.
Hiding WordPress Version
Hiding the WordPress version is crucial for security reasons, as it prevents potential attackers from targeting known vulnerabilities.
<?php
// Hide WordPress version
remove_action('wp_head', 'wp_generator');
?>
How It Works:
- Action Hook: The
remove_action
function targets thewp_generator
action hook, which removes the WordPress version meta tag from the HTML<head>
section.
Conclusion
By implementing these customization techniques, you can significantly enhance the security and user experience of your WordPress website’s login screen. Remember to always test these changes in a staging environment before applying them to your live site. Customizing these elements not only boosts security but also contributes to a more polished and professional appearance for your visitors.
Now that you’ve learned how to customize your WordPress login screen, take control of your website’s security and user experience today!
Highly Rated Books on WordPress from Amazon
Here are some highly rated books on WordPress that you might find useful:
- “WordPress All-in-One For Dummies” by Lisa Sabin-Wilson
- “Professional WordPress: Design and Development” by Brad Williams, David Damstra, and Hal Stern
- “WordPress Plugin Development Cookbook” by Yannick Lefebvre
![]() |
![]() |
![]() |
Support Techcratic
If you found this guide helpful and would like to support Techcratic, consider making a Bitcoin donation. Your contributions help us continue to provide high-quality content and resources. You can donate to the following Bitcoin address:
Bitcoin Address: bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge
If you wish to donate through other means, please contact us via the Techcratic Contact form. Thank you.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.