deleted_user хук-событиеWP 2.9.0

Fires immediately after a user is deleted from the database.

Использование

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.
По умолчанию: null, for no reassignment
$user(WP_User)
WP_User object of the deleted user.

Список изменений

С версии 2.9.0 Введена.
С версии 5.5.0 Added the $user parameter.

Где вызывается хук

wp_delete_user()
deleted_user
wpmu_delete_user()
deleted_user
wp-admin/includes/user.php 447
do_action( 'deleted_user', $id, $reassign, $user );
wp-admin/includes/ms.php 210
do_action( 'deleted_user', $id, null, $user );

Где используется хук в 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 );