• I am trying to customize the password retrieval message by applying a filter as follows:

    function retrieve_password_message_filter($message, $key, $user_login, $user_data) {
    
    $message = __('Someone has asked to reset the password for the following username on this site:') . "\r\n\r\n";
    	$message .= site_url( '/secrets/') . "\r\n\r\n";
    	$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    	$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
    	$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
    	$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
    	return $message;
    }
    add_filter ( 'retrieve_password_message', 'retrieve_password_message_filter');

    This works but the link for the password reset is invalid. Obviously something else needs to be added to the code above but my searches everywhere seem to show that the code I am using is supposed to work. Would you be able to help?

  • The topic ‘Customize retrieve password message’ is closed to new replies.