Are you looking for a way to hide login error messages? For security reasons, you might want to hide the login messages that WordPress shows when someone is trying to login with the wrong information. The message “Invalid username” assists hackers in finding the right username and password, so with this snippet you can disable that message.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
add_filter( 'login_errors', function( $errors ){ return ''; } );
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 6 Best WordPress Security Plugins Compared and how to create a popup form in WordPress.
Ehm, PHP Deprecated: Function create_function() is deprecated. Learn to use debug and test before you add code like this.