I have got this form for login from the front-end.
<form action="<?php echo site_url('wp-login.php', 'login_post'); ?>" method="post" <?php /*id="login-page-form"*/ ?>>
<label for="log"><?php _e('Usuario', 'gp_lang'); ?></label>
<input type="text" name="log" id="log" value="<?php echo esc_html(stripslashes($user_login), 1) ?>" size="22" placeholder="<?php _e('Usuario', 'gp_lang'); ?>" />
<label for="pwd"><?php _e('Contraseña', 'gp_lang'); ?></label>
<input type="password" name="pwd" id="pwd" size="22" placeholder="<?php _e('Contraseña', 'gp_lang'); ?>" />
<input type="submit" name="submit" value="<?php _e('Login', 'gp_lang'); ?> →" class="button" />
<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> <?php _e('Recuerdame', 'gp_lang'); ?></label>
<input type="hidden" name="redirect_to" value="<?php if(preg_match("/key=/", $referrer)) { echo home_url(); } else { echo $referrer; } ?>"/>
</form>
Everything works fine except when the user uses wrong login details. If an user enters a wrong username or password the next page is “wp-login.php”. But I want it to redirect to my homepage (get_site_url) with proper message to the user about the wrong login.
You can create a login failed action hook,