If you want instead of redirect to wp-login
the user redirect to login
page then use the following code. It will redirect user to login
page where login form is present.
add_filter('site_url', 'wplogin_filter', 10, 3);
function wplogin_filter( $url, $path, $orig_scheme ){
$old = array( "/(wp-login\.php)/");
$new = array( "login/");
return preg_replace( $old, $new, $url, 1);
}
add_action('init','possibly_redirect');
function possibly_redirect(){
global $pagenow;
if( 'wp-login.php' == $pagenow ){
wp_redirect(site_url( $path="login"));
exit();
}
}
In login form ckeck the value of action. For login use wp_signon()
function.
if(!isset($_REQUEST['action'])) { ?>
<div>Login with the Email
<form id="login-form" action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">
<table style="float: left;">
<tr>
<td><label>User Name</label></td>
<td>
<input type="text" name="user_name" id="user_name" placeholder="Enter your username">
</td>
</tr>
<tr>
<td><label>Password</label></td>
<td>
<input type="password" name="password" id="password" placeholder="Enter password"><br>
<a href="https://wordpress.stackexchange.com/questions/104241/<?php echo site_url("login/?action=lostpassword') ?> "> Forgot Your Password ? </a><br>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" id="login-submit" value="Login"></td>
</tr>
</table>
</form>
<?php
}
For lost password. Create form in the same login page
if(isset($_REQUEST['action']) && 'lostpassword'== $_REQUEST['action'])
{
?>
<div id="tab3_login" class="tab_content_login" >
<p>Enter your username or email to reset your password.</p>
<form method="post" action="https://wordpress.stackexchange.com/questions/104241/<?php echo site_url("login/?action=tg_pwd_reset') ?>" class="wp-user-form">
<div class="username">
<label>Username or Email : </label>
<input type="text" name="user_login" value="" size="20" id="user_login" />
<?php toolTip('user_login', 'Username');?>
</div>
<input type="submit" name="user-submit" value="<?php _e('Reset my password'); ?>" class="user-submit" tabindex="1002" />
</form>
</div>
<?php
}