Get the password key when using the wp_new_user_notification_email filter

I’m trying to customize the email sent to newly registered users. I use the wp_new_user_notification_email filter in a plugin, and it’s working fine to set the subject and message. However I would like to send the link to reset the user’s password the same way the normal WP notification email does.

From what I see in the wp_new_user_notification function, the password key in hashed before being stored in the database. This key is then used in the url to reset the password. The problem is that I cannot access this variable in the function I call with the wp_new_user_notification_email filter, and if I generate a randow key to put in the url WP throws an error in the form (probably because the new key doesn’t correspond to the stored hashed key).

I guess there is a way to achieve this, because having a filter to customize the registration message without giving the link to reset the password would be pretty pointless.

Any idea ?

Read more here:: Get the password key when using the wp_new_user_notification_email filter

Leave a Reply

Your email address will not be published. Required fields are marked *