如何在自定义登录页面上检查来自 wp_user table 的用户?

How can I check a user from wp_user table on a custom login page?

我正在为用户登录页面构建一个新的登录页面,但我使用的是 wp_user table。当我尝试使用 md5() 或 wp_hash_password() 检查用户密码时,它不起作用。

我的代码如下:

    <?php if(isset($_POST['submit'])){
     //print_r($_POST); die();
     $user_email=$_POST['email'];
     $user_pass=$_POST['pass'];
     $encuser_pass = wp_hash_password( $user_pass );

    echo $check_user="select * from wp_users WHERE user_login='$user_email'AND user_pass='$encuser_pass)";
  //echo $check_user; die;

    $run=$wpdb->get_results($check_user, ARRAY_A);

    if(count($run))
    {
       $_SESSION['email']= $user_email;//here session is used and value of $user_email store in $_SESSION.

    wp_redirect( get_site_url().'/dashboard/');
    exit;

    }

    else
    {
        echo "<script>alert('Email or Password is wrong')</script>";
    }



       }?>

它不起作用。我需要用什么方式来实现它?

<?php require_once(ABSPATH . 'wp-includes/class-phpass.php'); 
<?php if(isset($_POST['submit'])){
     $user_email=$_POST['email'];
     $user_pass=$_POST['pass'];

    global $wpdb;
    $check_user="select user_pass from wp_users WHERE user_login='$user_email'";

    $wp_hasher = new PasswordHash(8, TRUE);
    $password_hashed = $wpdb->get_var($check_user);

    if($wp_hasher->CheckPassword($user_pass, $password_hashed)) {
        echo "YES, Matched";
    } else {
        echo "No, Wrong Password";
    }
}