It’s definitely not the first time that I ran into this situation; A user was added to the website without checking the “Skip confirmation email” checkbox. Now, we’d like to force this user into the website and just send a login and password over, but now we get the message:
That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.
We don’t have a couple of days to wait, and we don’t want to use another e-mail address either. So what do we do?
Note: This is a developer oriented approach for deleting pending users. If you’re not comfortable with WP-CLI or database changes, have a look at the Uncomfirmed plugin.
Let’s go with WP-CLI
Let’s dive into the database
But honestly – I’d rather leave the database untouched. I rarely touch WordPress databases and prefer to do any interaction with the database via code and terminal.
So let’s use WP CLI as a wrapper instead!
So, first off – where are these pending activations stored? They’re in the wp_signups
table.
Let’s have a look at all pending activations first:
wp db query "SELECT * FROM wp_signups"
Now that we confirmed that the user is in there, let’s specify the query further;
wp db query "SELECT * FROM wp_signups WHERE user_email = '{USER_EMAIL}'"
(you can use any other data and column as well, the first command will give you all information.)
Okay, so we nailed down the user – now, it’s time for deletion, we’ll change the query a bit, and execute the deletion with the following command.
The WP-CLI command to delete a pending user from the database
wp db query "DELETE FROM wp_signups WHERE user_email = {USER_EMAIL}"
And there you go – the e-mail address is free to use again!
Camilo Luna says
Hi Marinus,
A few weeks ago signup commands for WP CLI (v2.11.0) were introduced: https://make.wordpress.org/cli/2024/08/08/wp-cli-v2-11-0-release-notes/
If you update WP CLI to the latest version, you can do so with the delete command: https://developer.wordpress.org/cli/commands/user/signup/delete/
Hope that’s useful for you or anyone else finding this article!
Marinus Klasen says
Nice!! Thanks for sharing ๐