So, I'm working on a plugin in which I'm making a custom page containing a login form as well as one for user registration; I have the forms built and operational, below is my code.
<!-- Begin login form -->
<form name="loginform" id="login_form" class="login_form" action="<?php echo esc_url( wp_login_url() ); ?>" method="post">
<p>
<input type="text" name="log" id="user_login" class="input" placeholder="Username" />
</p>
<p>
<input type="password" name="pwd" id="user_pass" class="input" placeholder="Password" />
</p>
<button name="wp-submit" id="wp-submit" class="btn"><?php _e("Sign in", "shorti"); ?></button>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER["REQUEST_URI"]; ?>" />
</form>
<!-- end login form -->
<!-- Begin registration form -->
<form method="post" id="register_form" class="wp-user-form" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>">
<p><!-- Username -->
<input type="text" name="user_login" id="user_login" class="input" placeholder="username" />
</p>
<p><!-- Email to send p/w to -->
<input type="email" name="user_email" id="user_email" class="input" placeholder="email address" />
</p>
<p class="small-text">You will receive an email with a generated password<br />(which you can change in your "user settings")</p>
<?php do_action('register_form'); ?>
<button name="wp-submit" id="wp-submit" class="btn"><?php _e("Register!", "shorti"); ?></button>
<?php $register = $_GET['register']; if($register == true) { echo '<p>Check your email for the password!</p>'; } ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />
<input type="hidden" name="user-cookie" value="1" />
</form><!-- end registration-form -->
This works fine beside the fact that whenever there's an error message it redirects the user to wp-login.php. I'm needing the page with the form to handle all the errors with AJAX; so as to give a better user experience. What is the best way to go about doing this?
wp-login.php
require more page-loads; which is not what I want. A few of the things I found are... here and here