June 19, 2010

How does table_prefix fit into WP 3.0?

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?

—Update—

Mike Schinkel from LinkedIn says:

Multisite is a plugin you have to enable. The database layouts should pretty much stay the same as you had before.

I’m pretty sure regular sites will upgrade as non-multisite and WPMU sites will upgrade as multisite, and you’ll get the choice during new installations.

That’s my guess too.

It seems MU is the mistress who moved in with the wife, $table_prefix, yet each pretends the other doesn’t exist. They seem to have opposing interests (user-generated content vs. edited content) yet both bring (multi-site) children.

Personally, I’d like to see MU swept under the rug. But I don’t think that’s going to happen. User-generated content brings in lots of cash. Edited content costs more to produce.



Photo gallery html5?
6 comments on page 1305

I use wpunlimited theme?
3 comments on page 1141

Slidebar image gallery html5?
4 comments on page 1053

Html5 photo gallery code?
6 comments on page 1305

Wpgetattachment?
25 comments on page 1065

How do you style polldaddy css?
2 comments on page 42

Disqus themes?
7 comments on page 1175

Is wordpress a framework for php?
2 comments on page 335

Css log in screend?
no comment on page 128

Wordpress featured images?
25 comments on page 1065

Wordpress featured images?
25 comments on page 1065

Disqus add image in comment?
7 comments on page 1175

Wpcache?
9 comments on page 1310

Funny wordpress plugins?
2 comments on page 1376

Photoshop framework?
4 comments on page 296

Wpfun?
2 comments on page 1376

Css login screen?
no comment on page 128

Wordpress fun plugins?
2 comments on page 1376

Get alll images of post wordpress?
25 comments on page 1065

Gallery html5?
6 comments on page 1305

Customisable short url?
4 comments on page 1190

Wordpress featuredimage?
25 comments on page 1065

Wp multiple sites?
one comment on page 1367

Flexx theme review?
4 comments on page 1026

Css login screen?
no comment on page 128

Wpupdatepost not working?
no comment on page 122

Html5 photo gallery code?
6 comments on page 1305

Html5 photo gallery code?
6 comments on page 1305

Show image in post?
25 comments on page 1065

Html5 image gallery?
6 comments on page 1305

Html 5 gallery?
6 comments on page 1305

Wordpress get post image?
25 comments on page 1065

Wpgetattachmentimagesrc?
25 comments on page 1065

Getimagefrompost resize?
25 comments on page 1065

Fun wordpress?
2 comments on page 1376

Wordpress workflow?
3 comments on page 1226

Google charts tinymce plugin?
7 comments on page 71

Easy peasy images featured image?
25 comments on page 1065

Html5 photo gallery code?
6 comments on page 1305

Simple css login screeen?
no comment on page 128

Wp flexx?
4 comments on page 1026

Create a div in div wp?
4 comments on page 1053
  every 1697s, 1s ago, in 0.02s.
 __
(__)
   `
 admin

Here’s my follow-up post:

http://wp-fun.co.uk/2010/06/20/residue-of-wordpress-mu/

 __
(__)
   `
 admin

I could backup my database and all of the files. And then do the upgrade and see what happens.

But I’d really like to know what I’m getting into. I want to know the philosophy of this MU-3.0 merger. (No, I wasn’t at WordCamp.)

I heard WP 3.0 only uses one set of plugins for multiple blogs–Is this default behavior or only if you activate multi-site? How do plugins know if the blogger is using multi-site or not? Does it matter?

Also, what happens to my options and posts? Are they merged into one table? Does the upgrade tool merge our options? I also have an options duplication plugin–so this further complicates things.


0s