2 ms·
global $wpdb; $prefix = str_replace('_', '\_', $wpdb->prefix); $tables = $wpdb->get_col("SHOW TABLES LIKE '{$prefix}%'"); foreach ($tables as $table) {
by corobo 8y ago
global $wpdb;
$prefix = str_replace('_', '\_', $wpdb->prefix);
$tables = $wpdb->get_col("SHOW TABLES LIKE '{$prefix}%'");
foreach ($tables as $table) {
$wpdb->query("DROP TABLE $table");
}
Essentially for those who aren't familiar with WordPress databases - this drops all tables relating to the WordPress install