Remove login error message from WordPress
When we fail to login to the WordPress, it shows different error message telling that what went wrong from our side. This is good in normal cases because it help to realize the problem.
But it might also be good for people who want to hack our blog because they can easily guess some common username & password for our blog & ensure that they exist by this way.
There is a simple hack to prevent WordPress from displaying error messages on failed logins.
We just want to add a single line of code in our child theme’s functions.php
file.
add_filter('login_errors',create_function('$a', "return null;"));
Save the file, logout and try to login with an invalid username or password. There is no more messages are displayed if you fail to login.
Here we added a simple hook to overwrite the default login_errors()
function of WordPress. The custom function that we created returns only null & so the message displayed will be a blank string.
Looking for a skilled WordPress/WooCommerce developer? I'm currently available for freelance, contract, or full-time remote opportunities! Let's create something amazing together. Send me a quick message, and I'll respond within 24 hours!
Recent Posts
- REST API Methods Explained with Best Practices for Building Clean and Secure APIs
- My 28-Day Plan to Master Modern WordPress Development Using AI Tools
- Scaling WordPress - How Custom Database Tables Solve the Post Meta Bottleneck
- WordPress Transients Explained - A Developer's Guide to Site Performance
- Behind the Click - The Hidden Journey of Your Web Requests
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.