php - retrieve_password_notification_email hook not working as expected. What can I do?
one text
i am trying to send the password reset email to a secondary email address saved in usermeta, not the main one used for registration. I'm using the retrieve_password_notification_email hook, but my function seems does not get executed. https://developer.wordpress.org/reference/hooks/retrieve_password_notification_email/
here's my code:
`
add_filter( 'retrieve_password_notification_email','forward_notification_function');
function forward_notification_function($defaults) {
$userID = $defaults['user_data']->get_the_ID();
$name = get_user_meta( $userID , 'billing_company', true);
$notification_email = get_user_meta($userID, 'ima_email', true);
$defaults['to'] = "TO: ".$name ." ".$userID." <".$notification_email.">\r\n";
return $defaults;
}
`
I also tried to run a simple wp_mail call using the hook but it does not work for some reason
Source