Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Like this:

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Yes. The full answer is here in the codex:

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');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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