Skip to content

Instantly share code, notes, and snippets.

@Balakrishnan-flycart
Balakrishnan-flycart / delete-plugin-tables.php
Created February 8, 2021 10:28 — forked from cgrymala/delete-plugin-tables.php
Delete Extra Plugin Tables When a Site Is Deleted in WordPress Multisite
<?php
/**
* Add any custom tables that this plugin creates for an individual site to the list
* of tables that get deleted when a site is deleted.
* @see https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-admin/includes/ms.php#L116
*/
add_filter( 'wpmu_drop_tables', 'delete_my_plugin_tables', 10, 2 );
function delete_my_plugin_tables( $tables=array(), $blog_id=null ) {
/**
* Make sure the blog ID parameter was sent, so we don't