Created
August 12, 2018 21:30
-
-
Save aleclarson/22eacd300851cc676bfa748acbff8892 to your computer and use it in GitHub Desktop.
WordPress script for dropping tables based on their name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tables = $wpdb->get_results(" | |
SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'i9JAv_%'; | |
"); | |
$tables = array_map(function($tbl) { | |
return $tbl->table_name; | |
}, $tables); | |
$tables = implode(', ', $tables); | |
$wpdb->query(" | |
DROP TABLE IF EXISTS $tables; | |
"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment