How to hide WordPress login error messages

Instead of displaying that the username or password are incorrect, how can I display only an error message when logging in?

Add this code in functions.php or your plugin:

<?php
// hide detailed error message
add_filter('login_errors', function($error) { return 'Login error'; } );
?>

Submit a Comment

Your email address will not be published. Required fields are marked *