WordPress

Delete a WordPress user with WP-CLI

This guides outlines how to delete and remove a WordPress user from your WordPress using WP-CLI. You can delete users from your Ecenica WordPress website using the WP-CLI command tools in your Ecenica web hosting plan.

WP-CLI is available on all Ecenica WordPress Hosting plans. You can run these commands from your own SSH terminal or in our control panel terminal. Our expert help and support team are also available to help you understand and run these commands on your WordPress websites.

How to delete a WordPress user using WP-CLI

First change to the folder containg your WordPress.

cd public_html

First, use the wp user list command to get a list of your WordPress site’s current users.

wp user list

You can modify the command to filter users with specific roles, for example, administrators.

wp user list --role=administrator

Use the command below to delete a WordPress user using WP-CLI, replacing username with the WordPress user you wish to delete.

wp user delete username

A prompt may appear asking if you wish to also delete the user’s posts. If you want to reassign the posts user use the command below. Change user-id to one of the other users from the wp user list command.

wp user delete username --reassign=user-id

Was this guide helpful?

Need help with this?

Open a ticket and link to this guide so our team can see what you have tried.

View support tickets

Power your business with Ecenica Hosting

Built for WordPress and serious websites. Fast, secure and supported by real people in the UK.

Ecenica hosting services represented by a connected red route across London