Skip to content

Instantly share code, notes, and snippets.

@yanknudtskov
Created February 5, 2018 05:36
Show Gist options
  • Save yanknudtskov/502f3587df16c97e2eabc7b3451288f1 to your computer and use it in GitHub Desktop.
Save yanknudtskov/502f3587df16c97e2eabc7b3451288f1 to your computer and use it in GitHub Desktop.
WordPress Password Reset mails filter, because gmail sometimes removes the link, this fixes it. #passwordreset #wpmail
<?php
add_filter('retrieve_password_message', 'yanco_custom_password_reset', 99, 4);
function yanco_custom_password_reset($message, $key, $user_login, $user_data ) {
$message = __('Someone has requested a password reset for the following account:') . "<br><br>";
$message .= network_home_url( '/' ) . "<br><br>";
$message .= sprintf(__('%s'), $user_data->user_email) . "<br><br>";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "<br><br>";
$message .= __('To reset your password use the link below:') . "<br><br>";
$message .= "<a href=".network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') .">Click here to reset your password</a><br><br>";
$message .= "Or copy and paste this link into your browser:<br><br>".network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login')."<br><br>";
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment