I'm working on a plugin which creates a new table. I've got it working fine on a single site install, but I'm not so sure about multisite.
How do I create a table for each blog on network activation?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
I would actually advise against doing that.
If you create a table for each blog on network activation you'll start running into scalability issues. Some Multisite networks are small (2-10 sites) and wouldn't cause too many issues. But larger networks (1000+ sites) would add a lot to the database if they added their plugin.
Instead, I'd recommend creating a single table and adding a "blog_ID" column to the table. If you're running a single site installation, just set that column to be 0 and run everything normally. But on a Multisite installation, set that column to whatever blog is using that data.
A single table is easier to manage.
Besides, if you create a new table for each blog, not only do you need the massive creation script when first activating the plugin, but you need to hook into the site creation mechanism to create a new table whenever a site is created.