Delete A User
if ($user_id == wp_get_current_user())
{
//Log the user out
wp_logout();
//Delete their account
if (!current_user_can('administrator')) //Don't accidentally delete our admin account!
{
require_once(ABSPATH.'wp-admin/includes/user.php'); //THis may be required to avoid "Fatal error: Uncaught Error: Call to undefined function wp_delete_user()"
wp_delete_user($user_id);
}
}
User Deleted Hook
//**************************************
//**************************************
//********** DELETE USER HOOK **********
//**************************************
//**************************************
add_action( 'delete_user', 'my_delete_user' );
function my_delete_user($user_id)
{
global $wpdb;
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.