I'm developing a user management table, in which an user (I've already set restriction for for some specific roles) can create/edit or delete a user. How can I delete a user by clicking on delete link or button, I have stored the id in a variable.
If you know the user id, you could create a link similar to https://example.com/wp-admin/users.php?action=delete&user=2 , where the value of the user is the user ID.
You can also hook into a function in the
users.php file. It's a core file, so you don't want to change it. But you can use the functions therein to properly delete the user.