do_action( 'delete_user', int $id, int|null $reassign, WP_User $user )
- Since
- 2.0.0, 5.5.0
Fires immediately before a user is deleted from the site.
Description
Note that on a Multisite installation the user only gets removed from the site and does not get deleted from the database.
Compatibility
- WordPress
- since 5.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$idint- ID of the user to delete.
$reassignint|null- ID of the user to reassign posts and links to.
Default null, for no reassignment. $userWP_User- WP_User object of the user to delete.
Where this hook fires · 1
wp-admin/includes/user.php:385wp_delete_user()
Source code
* * @param int $id ID of the user to delete. * @param int|null $reassign ID of the user to reassign posts and links to. * Default null, for no reassignment. * @param WP_User $user WP_User object of the user to delete. */ do_action( 'delete_user', $id, $reassign, $user ); if ( null === $reassign ) { $post_types_to_delete = array(); foreach ( get_post_types( array(), 'objects' ) as $post_type ) { if ( $post_type->delete_with_user ) { $post_types_to_delete[] = $post_type->name;Changelog
Introduced in 2.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.5.0
Added the
$user parameter.from the docblock2.0.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.