WordPress reset password key doesn’t work
-
I have a function that creates a WordPress user and then sends the user an email greeting with a link to reset their password. However, the key generated by
get_password_reset_key
never seems to work.Here is my code:
$key = get_password_reset_key( get_user_by( 'id', $user_id ) ); $password_link = esc_url_raw( add_query_arg( array( 'action' => 'rp', 'key' => $key, 'email' => $user_email ), site_url( 'wp-login.php' ) ) ); $message = 'Welcome, here is a link to reset your password: %s'; $message = sprintf( $message, $password_link );
The password link contains a hashed key as expected, but WordPress indicates the key is invalid. I have tried this on both my local development server and with my production setup. I have no idea what I could possibly be getting wrong. Any ideas?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘WordPress reset password key doesn’t work’ is closed to new replies.