Function: wp_delete_user

wp_delete_user( integer $id, integer $reassign )

Remove user and optionally reassign posts and links to another user.

If the $reassign parameter is not assigned to a User ID, then all posts will be deleted of that user. The action \'delete_user' that is passed the User ID being deleted will be run after the posts are either reassigned or deleted. The user meta will also be deleted that are for that User ID.


Name Type(s) Default Value Description
$id integer

User ID.

$reassign integer null

Optional. Reassign posts and links to new User ID.



True when finished.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.