do_action( ‘deleted_user’, int $id, int|null $reassign, WP_User $user )

Fires immediately after a user is deleted from the site.

Description

Note that on a Multisite installation the user may not have been deleted from the database depending on whether wp_delete_user() or wpmu_delete_user() was called.

Parameters

$idint
ID of the deleted user.
$reassignint|null
ID of the user to reassign posts and links to.
Default null, for no reassignment.
$userWP_User
WP_User object of the deleted user.

More Information

The deleted_user action/hook can be used to perform additional actions after a user is deleted. For example, you can delete rows from custom tables created by a plugin.

This hook runs after a user is deleted. The hook delete_user (delete vs deleted) runs before a user is deleted. Choose the appropriate hook for your needs. If you need access to user meta or fields from the user table, use delete_user.

Source

do_action( 'deleted_user', $id, $reassign, $user );

Changelog

VersionDescription
5.5.0Added the $user parameter.
2.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.