Skip to content

Instantly share code, notes, and snippets.

@aprea
Created December 4, 2012 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aprea/4209748 to your computer and use it in GitHub Desktop.
Save aprea/4209748 to your computer and use it in GitHub Desktop.
Get all DB tables from a WordPress database installation
function reset_array( &$value, $key ) {
$value = $value[0];
}
function get_tables() {
global $wpdb;
$results = $wpdb->get_results( 'show tables from ' . DB_NAME, ARRAY_N );
array_walk( $results, 'reset_array' );
return $results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment