Created
September 12, 2017 21:38
-
-
Save barryhughes/863dcf59c08a793681cfcead20c8e3da to your computer and use it in GitHub Desktop.
Helper script to drop a bunch of imported tables from a WP test site.
This file contains 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
<?php | |
/** | |
* Drop a bunch of tables. | |
* | |
* Update the prefix in the foreach definition then run via WP-CLI, | |
* ie "wp eval-file ../path/to/this-script.php". | |
*/ | |
global $wpdb; | |
foreach ( $wpdb->get_col( "SHOW TABLES LIKE 'customer_db_%'" ) as $table ) { | |
$wpdb->query( $wpdb->prepare( 'DROP TABLE %s', $table ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment