From time to time when you're developing plugins/themes you may need to delete some test user accounts. Here is a way to do it.
You can either create an MU Plugin (by creating a file in mu-plugins/some-code.php) or adding it in functions.php in your current (child) theme.
Then go to the admin area. I was receiving errors (function doesn't exist) when I wasn't in the admin area.
You have to be careful with this code.
[php]
add_action('admin_init', 'abc_quick_del', 10);
// !!!
function abc_quick_del() {
$user = get_user_by( 'login', 'some_username');
if (!empty($user->ID)) {
echo "Deleting user ID: " . $user->ID . "<br/>\n";
wp_delete_user( $user->ID );
} else {
echo "Account not found.";
}
}
[/php]