deleted_user
Fires immediately after a user is deleted from the site.
Note that on a Multisite installation the user may not have been deleted from the database depending on whether wp_delete_user() wpmu_delete_user() called.
Usage
add_action( 'deleted_user', 'wp_kama_deleted_user_action', 10, 3 ); /** * Function for `deleted_user` action-hook. * * @param int $id ID of the deleted user. * @param int|null $reassign ID of the user to reassign posts and links to. * @param WP_User $user WP_User object of the deleted user. * * @return void */ function wp_kama_deleted_user_action( $id, $reassign, $user ){ // action... }
- $id(int)
- ID of the deleted user.
- $reassign(int|null)
- ID of the user to reassign posts and links to.
Default: null, for no reassignment - $user(WP_User)
- WP_User object of the deleted user.
Changelog
Since 2.9.0 | Introduced. |
Since 5.5.0 | Added the $user parameter. |
Where the hook is called
deleted_user
wp-admin/includes/user.php 463
do_action( 'deleted_user', $id, $reassign, $user );
wp-admin/includes/ms.php 211
do_action( 'deleted_user', $id, null, $user );
Where the hook is used in WordPress
wp-includes/default-filters.php 110
add_action( $action, 'wp_maybe_update_user_counts', 10, 0 );
wp-includes/ms-default-filters.php 34
add_action( 'deleted_user', 'wp_delete_signup_on_user_delete', 10, 3 );