It is possible send email for deleting account on wordpress??

Like this: https://i.stack.imgur.com/Lt6Ks.png

Ok after click send email to user with ex text: "your account has been deleted" ??

2 Answers 2


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');
  • +1 mostly for the content of the email Mar 13, 2019 at 19:57

I recommend you to use Send Mail on User Delete plugin. It gives you to change the mail content too from admin. You can send email both user as well as admin.

  • FYI plugin referenced above has not been updated in 4+years. Sep 2, 2020 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.