Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Send Email to Users after Deleting Account

Yes. The full answer is here in the codex: http://codex.wordpress.org/Plugin_API/Action_Reference/delete_user

So I won’t repost its code.

function my_delete_user($user_id) {
    global $wpdb;
    $email = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID = '" . $user_id . "' LIMIT 1");

     $headers="From: " . get_bloginfo("name") . ' <' . get_bloginfo("admin_email") . '>' . "\r\n";
     wp_mail($email, 'You are being deleted, brah', 'Your account at ' . get_bloginfo("name") . ' is being deleted right now.', $headers);
}
add_action( 'delete_user', 'my_delete_user');

Related Posts:

  1. Add email addresses to already registered users
  2. how can i inform other users about new user registration? [closed]
  3. get_user_meta() doesn’t include user email?
  4. Confirmation required on email change
  5. Email user when password is reset by admin
  6. How to set up User email verification after Signup?
  7. How can I get users email (and additional data) from the rest API?
  8. How to discover and delete unused accounts?
  9. Send activation email to user after signup [duplicate]
  10. Buddypress – Send New User Activation Link to Admin [closed]
  11. Adding second Email address for WP user notifications
  12. How can I check if a user’s email exists in the database
  13. Suddenly all emails in User have [email protected]
  14. Translate emails into the language of the user
  15. How to notify specific users when i’m posting/modifying a new post
  16. Unable to change email address of admin on localhost
  17. Send email to all registered users [closed]
  18. how to remove email field from default user registration form on wordpress
  19. What is correct way to change user’s email?
  20. Send clear password via mail
  21. Need to manually add multiple WP users with same e-mail address (with good reason)
  22. WP Create User – Preventing repeated information
  23. User with same Mail but a different additional info(like domain)
  24. How do I update user email from frontend input field?
  25. Custom Password Reset
  26. Send user auto generated password on different email
  27. User email verification without a plugin, is it possible?
  28. Exclude Current user email and send notification
  29. New User Registration email
  30. Email Subscribe for Downloads in WordPress
  31. Remove My Account Menu items in Woocommerce based on user roles
  32. How to change the default registration email ? (plugin and/or non-plugin)
  33. Make WooCommerce pages accessible for logged in users only
  34. How to limit users to one comment per post
  35. Is there an upper limit for users in WP?
  36. How to get the Gravityform entry ID from current user’s form submission? [closed]
  37. Post list based on the user that is logged in
  38. Extending WP_User class and using this sub-class during the whole lifecycle
  39. Why does is_user_logged_in() return false after redirect from another site?
  40. How can I add a user through SQL?
  41. How to use tinyMCE for user “biographical info” without messing with any core file?
  42. Get user info outside WordPress
  43. How to change the order in which users are displayed in admin?
  44. Total number of authors with more than one post
  45. WordPress has a trash for users? (Wrong result for count_user, greater than expected)
  46. How Do I Prevent Junk Account Creation?
  47. Hide a user from WordPress
  48. Redirect after users complete profile form
  49. Cannot set user passwords
  50. Memory usage for scalable usermeta queries
  51. Can’t add users in admin after copying database
  52. How can i create an array user meta?
  53. Exclude admin from user list
  54. How to display total number of post done by user, it should display at authors page wordpress [duplicate]
  55. When I try to login in wordpress it is showing “USER Doesn’t Exists”
  56. Displaying different in-page content to cliente/admin
  57. Can i add password field into my wp registration form?
  58. User capability for editing their own comments
  59. how to get WordPress admin user table columns name in my plugin
  60. Allow Contributors to Upload Files
  61. Create Next and Previous Link to User orderby Last Name
  62. OAuth 2 and saving the authenticated user
  63. Spam users registers even when registration is disabled
  64. Getting the age of a users account
  65. New user form rejected because “passwords don’t match”—but there’s only one password field
  66. How can I prevent certain custom roles from seeing other custom roles on the user list page?
  67. “the_author_meta(‘url’)” not working inside “href”
  68. REST API: wp_get_current_user not working on second call
  69. How do I filter users based on email address?
  70. How to get custom post_author?
  71. User roles not displaying
  72. Allow admins to login as other users
  73. How to count total words for posts published by one author?
  74. Should I setup frontend-only users as CPT or use a plug-in?
  75. How to expire user registration?
  76. Delete a user from frontend
  77. Echo a list of all subscriber’s user IDs
  78. wp_delete_user – huge overhead in Buddypress?
  79. Get current logged-in user from external site
  80. Delete all users with Editor role and their content mysql
  81. Get UserInfo from WordPress
  82. How to display a calendar with events depending on the user?
  83. How can i display pagination in custom comment list?
  84. hide page menu from admin panel for specific users
  85. Single Sign On (SSO) between two WordPress websites
  86. Disabling user capability to edit_posts or delete_posts in the front-end
  87. $user_login is not working if author has only 1 post
  88. How to use a transient inside WP_User_Query
  89. Allowing users to edit only their page and nobody else’s
  90. How to bulk change user role to “No role for this site”
  91. Showing extra profile fields in admin – problem with underscore
  92. Insert query not working for non-logged in user
  93. Add new user and user bio at same time
  94. How to create a link to a user’s profile page
  95. Let admin users edit member profiles from front end
  96. Storing additional information about the user
  97. Current User Seeing Another Logged In User Info
  98. What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
  99. Cant edit profile from frontend
  100. application password is missing
Categories users Tags account, email, users
What are ideal hooks to call register_sidebars?
How to search in two different wordpress blogs by using a single searchform?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress