Action hook 'wpmu_delete_user'

in WP Core File wp-admin/includes/ms.php at line 174

View Source

wpmu_delete_user

Action Hook
Description
Fires before a user is deleted from the network.

Hook Information

File Location wp-admin/includes/ms.php View on GitHub
Hook Type Action
Line Number 174

Hook Parameters

Type Name Description
int $id ID of the user about to be deleted from the network.
WP_User $user WP_User object of the user about to be deleted from the network.

Usage Examples

Basic Usage
<?php
// Hook into wpmu_delete_user
add_action('wpmu_delete_user', 'my_custom_function', 10, 2);

function my_custom_function($id, $user) {
    // Your custom code here
}

Source Code Context

wp-admin/includes/ms.php:174 - How this hook is used in WordPress core
<?php
 169  	 * @since 5.5.0 Added the `$user` parameter.
 170  	 *
 171  	 * @param int     $id   ID of the user about to be deleted from the network.
 172  	 * @param WP_User $user WP_User object of the user about to be deleted from the network.
 173  	 */
 174  	do_action( 'wpmu_delete_user', $id, $user );
 175  
 176  	$blogs = get_blogs_of_user( $id );
 177  
 178  	if ( ! empty( $blogs ) ) {
 179  		foreach ( $blogs as $blog ) {

PHP Documentation

<?php
/**
	 * Fires before a user is deleted from the network.
	 *
	 * @since MU (3.0.0)
	 * @since 5.5.0 Added the `$user` parameter.
	 *
	 * @param int     $id   ID of the user about to be deleted from the network.
	 * @param WP_User $user WP_User object of the user about to be deleted from the network.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-admin/includes/ms.php
Related Hooks

Related hooks will be displayed here in future updates.