How does $table_prefix fit into WP 3.0? Upgrading 9 blogs and plugins.
-
I’m thinking about upgrading 9 blogs and a couple of plugins I wrote. They all depend on $table_prefix, which you all know is in wp-config.php since before Matt was Ma.tt.
Yes, I know WP 3.0 is multi-site. I’ve been using the recommended $table_prefix for several years now. Yes, it’s time to upgrade. Which is why I’m here. So what is the recommended way now to get all my data working with WP 3.0? I have millions of records stored in MySQL using $table_prefix.
Instead of using 9 wp-config files (doh!) I came up with this really simple way of using the same wp-config.php for all of my blogs:
$table_prefix = substr(str_replace(“-“, ”, $_SERVER[‘HTTP_HOST’]), 0, 4) . ‘_’;
The dash deal was added later for my “wp-fun.co.uk”
In plain English, this code simply uses the first four letters of the domain name for the $table_prefix. So for example, Knowingart.com would be “know_” instead of “wp_”. I use this same technique for all my plugins.
So a Knowingart.com plugin would use “know_myplugin” to store information, etc.
What do you think? Can I safely upgrade to WP 3.0?
- The topic ‘How does $table_prefix fit into WP 3.0? Upgrading 9 blogs and plugins.’ is closed to new replies.