Marinus Klasen

Marinus Klasen

  • Development
  • Consultancy
  • Developer Resources
  • Blog
  • Contact

October 31, 2023

Delete a pending user from WordPress

Marinus Klasen

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!

About Marinus Klasen

Marinus has been working in software/web development for more than a decade. Since 2020 his attention shifted on sharing knowledge and developing products and tools for sharing knowledge.

Marinus Klasen on Twitter

Looking for a WordPress expert?
Hire top notch developers on Codeable!

Consult an expert

Comments

  1. Camilo Luna says

    September 11, 2024 at 5:42 pm

    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!

    Reply
    • Marinus Klasen says

      September 11, 2024 at 5:52 pm

      Nice!! Thanks for sharing ๐Ÿ™‚

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get in touch

Contact me using the details below

Marinus Klasen

Wilhelmina van Pruisenweg 35, 2595 AN Den Haag

marinus@mklasen.com
twitter.com/marinusklasen
linkedin.com/in/marinusklasen

  • GitHub
  • LinkedIn
  • Twitter

Have you read?

  • Elementor Widget UsageMarch 27, 2025
  • Programmatically showing popups with ElementorMarch 25, 2025
  • The Elementor sanitize_settings errorSeptember 12, 2024
  • Announcing.. Wooping Shop Health!June 13, 2024
  • Swiper setup when using wp-scriptsMarch 14, 2024

Copyright © 2025 ยท Marinus Klasen | Webdesign by Team Rood