Skip to main content

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

FlagDescription
--reassign=USER_IDReassign all content to this user ID before deleting
--networkOn multisite, delete the user from the entire network
--yesSkip 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 production

Deleting an author without --reassign orphans their posts. Orphaned posts lose their author and may disappear from author archives.

  1. Always --reassign content to an active editor when offboarding authors.
  2. Back up firstwp db export — before any bulk deletion.
  3. Verify the reassign target is a real, active user ID with wp user get ID.
  4. Use --yes only in automated scripts where confirmation is not appropriate.

Troubleshooting

ProblemCauseFix
Error: Invalid user IDWrong identifierUse wp user list to find correct ID
Posts still appear as "No Author"--reassign not usedManually reassign with wp post update
Error: Cannot delete the Super AdminMultisite super adminRemove 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