GochiSiyan

change email reset link

May 11th, 2022 (edited)
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. add_filter('wp_new_user_notification_email', function ($mail) {
  2. preg_match_all('/(\?|\&)([^=]+)\=([^&]+)/', $mail['message'], $match);
  3. $new_link = '';
  4.  
  5. foreach ($match[2] as $index => $value) {
  6. $new_link .= "{$value}={$match[3][$index]}&";
  7. }
  8. $new_link = "?{$new_link}";
  9. $new_link = network_site_url("my-account/lost-password" . substr($new_link, 0, -1));
  10.  
  11. ob_start();
  12. ?>
  13. Reset your password with the link below
  14.  
  15. <?= $new_link ?>
  16. <?php
  17.  
  18. $mail['message'] = ob_get_clean();
  19.  
  20. return $mail;
  21. });
Add Comment
Please, Sign In to add comment