delete_user
Fires immediately before a user is deleted from the site.
Note that on a Multisite installation the user only gets removed from the site and does not get deleted from the database.
Usage
add_action( 'delete_user', 'wp_kama_delete_user_action', 10, 3 ); /** * Function for `delete_user` action-hook. * * @param int $id ID of the user to delete. * @param int|null $reassign ID of the user to reassign posts and links to. * @param WP_User $user WP_User object of the user to delete. * * @return void */ function wp_kama_delete_user_action( $id, $reassign, $user ){ // action... }
- $id(int)
- ID of the user to delete.
- $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 user to delete.
Changelog
Since 2.0.0 | Introduced. |
Since 5.5.0 | Added the $user parameter. |
Where the hook is called
wp-admin/includes/user.php 380
do_action( 'delete_user', $id, $reassign, $user );