[wp-hackers] WordPress MU category tables
Tim Schoffelman
tim at silentgap.com
Wed Dec 30 17:23:06 UTC 2009
Another question question (hopefully).
I'm building a plugin that will grab all the tables used in a WordPress MU
blog (note: I don't need all the tables, just the ones specific for that
blog the plugin is active on). The wpdb object contains the array
Install 2.7.1
[blog_tables] => Array
(
[0] => posts
[1] => categories
[2] => post2cat
[3] => comments
[4] => links
[5] => link2cat
[6] => options
[7] => postmeta
[8] => terms
[9] => term_taxonomy
[10] => term_relationships
)
Install 2.8.4a
[tables] => Array
(
[0] => posts
[1] => categories
[2] => post2cat
[3] => comments
[4] => links
[5] => link2cat
[6] => options
[7] => postmeta
[8] => terms
[9] => term_taxonomy
[10] => term_relationships
)
but in WordPress MU, the categories, post2cat & link2cat tables aren't used
(not on my installs anyways 2.7.1 && 2.8.4a). IE - there's no
wp_4_categories or wp_categories table.
I'm having to rely on something like this to pull the correct tables (but
feel as I shouldn't have too).
class BlogTables {
function selectNames() {
global $table_prefix, $wpdb;
$sql = "SHOW TABLES LIKE '".$prefix."%'";
$avail_tables = $wpdb->get_results($sql);
foreach ($avail_tables as $tables) {
foreach($tables as $key => $table){
$blog_tables[] = $table;
}
}
return $blog_tables;
}
}
Is there a better way or has this been or will this be corrected / changed
in the 2.8.6 or 2.9.* version(s)?
More information about the wp-hackers
mailing list