i’m working on customisation of a simple login page of wordpress.
the actual problem is even when i give the correct data for login it won’t login and has an error
here are my try :
<?php
/** Template Name: login */
global $user_ID;
if (!$user_ID){
if ($_POST){
$username= esc_sql($_POST['username']);
$password= esc_sql($_POST['password']);
$login_array= array();
$login_array['username']=$username;
$login_array['password']=$password;
$verify_user=wp_signon($login_array,true);
if(!is_wp_error($verify_user)){
echo "<script>window.location='".site_url()."'</script>";
}
else{
?>
<form action="" method="post">
<input type="text" name="username" id="username" placeholder="نام کاربری">
<input type="password" name="password" id="password" placeholder="رمز عبور">
<button type="submit">ورود کارکنان</button>
</form>
<?php
}
}
}
everything seems be correct but something is wrong
could someone please help me ?
2
Answers
regardless of the problem you are facing
Why not use the Ajax login and terminate the problem
https://gist.github.com/cristianstan/10273612
There’s a few things you probably need to do.
is_user_logged_in()
This would work: