I want to use my custom login form in wordpress. I want to show in my form the wordpress login error messages too but i don't know how to do this.
I have creaded the div class="log-msg" to output the login error messages.
Here my code:
my-custom-login.php
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
<input type="text" name="log" class="form-control" id="user-login" required>
<label for="user-login">Login</label>
<input type="password" name="pwd" id="user_pass" class="form-control" required>
<label for="user_pass">Password</label>
<?php
// Here how can i access to error login messages? //
echo '<div class="log-msg">'.$error.'</div>';
?>
?>
<button type="submit" name="btn-submit" id="btn-submit">
</form>
I've tried with
global $errors;
$err_codes = $errors->get_error_codes();
But it didn't works :S
Someone could help me please?
Thank you everybody!
source https://stackoverflow.com/questions/70146025/wordpress-how-to-access-error-messages-in-login-form
Comments
Post a Comment