0

I am currently developing an e-commerce site using WooCommerce on Wordpress. Whenever I login a non-existing username and password, there's no warning message saying that username or password is incorrect. I wanted it to look like this.

Image of the targeted look for error message in login page

enter image description here

I hope you could help me. Thank you

Ruvee
  • 8,611
  • 4
  • 18
  • 44

1 Answers1

0

Try This:

add_filter('login_errors', 'filter_login_errors', 10, 1);   
function filter_login_errors( $error ) {
    $error_type = strpos($error, 'incorrect');
    if (is_int($error_type)) {
        $error = '<span style="color:red">Oops! It seems that your username or password is incorrect. Please try it again.</span>';
    }
    return $error;
}
Rajeev Singh
  • 1,724
  • 1
  • 6
  • 23
  • Hi! Still not working on my end :( I tried placing the code using the snippet plugin. – Jhopat Santiago Sep 09 '21 at 03:52
  • I have added this code on my functions.php and test, it's working as excepted, please see : https://www.loom.com/share/15f58a7998384947897fe2a81dee8e2a – Rajeev Singh Sep 09 '21 at 05:15
  • One more thing, if you are still facing the issue, so you can print the error first and update/ change the error type: $error_type = strpos($error, 'incorrect'); or you can change IF condition also like: if ($error) {} in above code – Rajeev Singh Sep 09 '21 at 05:19