deleted_user
Action HookDescription
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()` or `wpmu_delete_user()` was called.Hook Information
File Location |
wp-admin/includes/user.php
View on GitHub
|
Hook Type | Action |
Line Number | 463 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$id
|
ID of the deleted user. |
int|null
|
$reassign
|
ID of the user to reassign posts and links to. Default null, for no reassignment. |
WP_User
|
$user
|
WP_User object of the deleted user. |
Usage Examples
Basic Usage
<?php
// Hook into deleted_user
add_action('deleted_user', 'my_custom_function', 10, 3);
function my_custom_function($id, $reassign, $user) {
// Your custom code here
}
Source Code Context
wp-admin/includes/user.php:463
- How this hook is used in WordPress core
<?php
458 * @param int $id ID of the deleted user.
459 * @param int|null $reassign ID of the user to reassign posts and links to.
460 * Default null, for no reassignment.
461 * @param WP_User $user WP_User object of the deleted user.
462 */
463 do_action( 'deleted_user', $id, $reassign, $user );
464
465 return true;
466 }
467
468 /**
PHP Documentation
<?php
/**
* 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()` or `wpmu_delete_user()`
* was called.
*
* @since 2.9.0
* @since 5.5.0 Added the `$user` parameter.
*
* @param int $id ID of the deleted user.
* @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 deleted user.
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-admin/includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.