I’ve created a custom login form in a template page using the basic wp_login_form. I’m using custom functions to prevent any access to the original wp-login.php.
My custom login doesn’t handle errors unlike the default login page. Do you have simple solution to display them (wrong username/password, blank field, etc.)?
Thanks.
I’m using this kind of code which seems to work (with wp_signon).
Assuming you are using
wp_signon
, simply check if the returned object is aWP_Error
instance, evaluate theWP_Error::get_error_code()
, and output appropriate HTML/CSS that your form needs to flag errors.Basic, untested sample code to illustrate the principle: