wp user delete
Overview
Permanently remove one or more WordPress user accounts. Use --reassign to transfer ownership of their content to another user — critical for preventing orphaned posts during offboarding.
What It Does
wp user delete removes the user from wp_users and wp_usermeta. Posts authored by that user become unowned unless --reassign is specified. Network-level user removal is also supported on multisite.
Syntax
wp user delete <user>... [OPTIONS]
USER can be a user ID, login, or email. Multiple users can be listed space-separated.
Arguments & Options
| Flag | Description |
|---|---|
--reassign=USER_ID | Reassign all content to this user ID before deleting |
--network | On multisite, delete the user from the entire network |
--yes | Skip confirmation prompt |
Basic Usage
Delete a user and reassign their posts
wp user delete jane --reassign=1
Delete multiple users
wp user delete 12 15 22 --reassign=1
Delete with no content reassignment (content becomes unowned)
wp user delete old-admin --yes
Real-World Scenarios
Scenario 1: Off-board a departing author
# 1. Find the leaving user
wp user get jane --fields=ID,user_login,user_email
# 2. Find the editor who will own content
wp user list --role=editor --fields=ID,user_login
# 3. Reassign content and delete
wp user delete jane --reassign=7
Scenario 2: Clean up bulk test users from staging
# Delete all subscriber test users
for id in $(wp user list --role=subscriber --field=ID); do
wp user delete "$id" --yes
done
echo "All test subscribers removed."
Scenario 3: Remove a spam account
# Find by email pattern before deleting
wp user list --fields=ID,user_login,user_email | grep "@spam-domain.com"
# Delete
wp user delete spam-user42 --yes
Best Practices
Always use
--reassign in productionDeleting an author without --reassign orphans their posts. Orphaned posts lose their author and may disappear from author archives.
- Always
--reassigncontent to an active editor when offboarding authors. - Back up first —
wp db export— before any bulk deletion. - Verify the reassign target is a real, active user ID with
wp user get ID. - Use
--yesonly in automated scripts where confirmation is not appropriate.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: Invalid user ID | Wrong identifier | Use wp user list to find correct ID |
| Posts still appear as "No Author" | --reassign not used | Manually reassign with wp post update |
Error: Cannot delete the Super Admin | Multisite super admin | Remove super admin first with wp super-admin remove |
Quick Reference
wp user delete <user> --reassign=<id> # Delete + reassign content
wp user delete <user> --yes # Delete without prompt
wp user delete 12 15 22 --reassign=1 # Bulk delete + reassign
Next Steps
wp user create— create a new replacement user.wp user list— audit users before deletion.wp user get— check user details before removing.