Filter hook 'wpmu_drop_tables'

in WP Core File wp-includes/ms-site.php at line 832

View Source

wpmu_drop_tables

Filter Hook
Description
Filters the tables to drop when the site is deleted.

Hook Information

File Location wp-includes/ms-site.php View on GitHub
Hook Type Filter
Line Number 832

Hook Parameters

Type Name Description
string[] $tables Array of names of the site tables to be dropped.
int $site_id The ID of the site to drop tables for.

Usage Examples

Basic Usage
<?php
// Hook into wpmu_drop_tables
add_filter('wpmu_drop_tables', 'my_custom_filter', 10, 2);

function my_custom_filter($tables, $site_id) {
    // Your custom filtering logic here
    return $tables;
}

Source Code Context

wp-includes/ms-site.php:832 - How this hook is used in WordPress core
<?php
 827  	 * @since MU (3.0.0)
 828  	 *
 829  	 * @param string[] $tables  Array of names of the site tables to be dropped.
 830  	 * @param int      $site_id The ID of the site to drop tables for.
 831  	 */
 832  	$drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $site->id );
 833  
 834  	foreach ( (array) $drop_tables as $table ) {
 835  		$wpdb->query( "DROP TABLE IF EXISTS `$table`" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
 836  	}
 837  

PHP Documentation

<?php
/**
	 * Filters the tables to drop when the site is deleted.
	 *
	 * @since MU (3.0.0)
	 *
	 * @param string[] $tables  Array of names of the site tables to be dropped.
	 * @param int      $site_id The ID of the site to drop tables for.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/ms-site.php
Related Hooks

Related hooks will be displayed here in future updates.