PHP · WORDPRESS DATABASE HYGIENE
wp-plugin-uninstalls — Clean uninstall.php Routines for Popular WordPress Plugins
wp-plugin-uninstalls is a reference library of thorough uninstall.php scripts that completely remove custom database tables, wp_options rows, cron hooks, and usermeta left behind by third-party WordPress plugins. Site administrators use it to audit and reclaim database storage after deactivating heavy plugins.
$ wp eval-file uninstall-audit.php
Copy
GitHub ↗
Plugins Covered
40+ Major Plugins
Multisite Support
get_sites() Iteration
Cron Teardown
wp_clear_scheduled_hook
Zero Leftovers
Options + Tables + Meta
01. Interactive Workbench
02. Reference Implementation
03. Architecture & Specs
Interactive `uninstall.php` Teardown Manifest Generator
Target Plugin Slug, Option Prefixes & Custom Tables
Environment Scope
Single-Site WordPress (`WP_UNINSTALL_PLUGIN` Guarded)
WordPress Multisite Network (`get_sites()` Blog Switching)
WP-CLI Non-Interactive Dry-Run Audit
Export Standalone `uninstall.php` Drop-In
Execute Pipeline ▶
Reset
Deterministic Execution Output & Telemetry
STATUS: READY // 0 ERRORS
PHP (Spec-Compliant `uninstall.php`)
<?php
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// 1. Clear scheduled cron hooks
wp_clear_scheduled_hook( 'hsp_daily_sync' );
// 2. Delete plugin options and transients
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'hsp\_%' OR option_name LIKE '\_transient\_hsp\_%'" );
// 3. Drop custom plugin tables
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hsp_slides, {$wpdb->prefix}hsp_analytics" );
wp_cache_flush();
Production Engineering Specifications
Repository: https://github.com/bhubbard/wp-plugin-uninstalls
Live Studio: https://code.brandonhubbard.com/wp-plugin-uninstalls/
Portal: https://code.brandonhubbard.com/
Install: git clone https://github.com/bhubbard/wp-plugin-uninstalls
Design System: Brandon Hubbard Swiss Modernist (#0A0A0C / 1px Exposed Structural Grid)