WP-CLI is a powerful command line utility for WordPress, which is included by default with your hosting plan or server. It can be used to perform many of the actions you would normally complete in the WordPress dashboard, such as installing or updating plugins and themes, managing users, making changes to the site configuration, and much more.
Here we cover the steps to remove a user using WP-CLI.
Related Articles
SSH into Shared Server
Find the Document Root of a Domain
Remove User
- Access the server via SSH or using the Terminal in cPanel
- Navigate to the site's document root using the cd command
cd public_html
REPLACE: public_html with your domain's document root if different. See the guide on finding the document root of a domain for guidance. - Run the following command to display a list of current users
wp user list
- Run the following command to remove the user
wp user delete userna5 --reassign=1
REPLACE: userna5 with the user_login or ID of the user you wish to remove.
CAUTION: Any changes made by the user you are removing will be lost if they are not reassigned to another user. Using the information obtained in step 3, add the ID of the user you wish to reassign changes to after "--reassign=", replacing "1" as needed.