Login code is not working when try programmatically

  • Unknown's avatar

    I am trying to use the connect with store using our application. So I have integrate the code in one of our WordPress plugin. But when I tried to login into the website programmatically it’s giving the error “Invalid Password”, while with the same password I can login into the store from frontend. I am using below code:

    if (preg_match(‘/b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b/si’, $username)){
    $email = wp_authenticate_email_password(‘WP_User’, $username, $password);
    }else{
    $user = wp_authenticate_username_password(‘WP_User’, $username, $password);
    }

    Can anyone help me to figure out this?

    Thanks,

    WP.com: Yes
    Correct account: Yes

    The blog I need help with is: (visible only to logged in users)

  • Please don’t post duplicate threads here: https://wordpress.com/forums/topic/invalid-password-while-putting-correct/

    If you have any further questions, please reply there, and we’ll follow-up as soon as we can.

  • The topic ‘Login code is not working when try programmatically’ is closed to new replies.