[wp-hackers] managing several MU installations

Jeremy Clarke jer at simianuprising.com
Mon Dec 14 15:34:08 UTC 2009

Hey guys, this is my solution. It's obviously pretty hacky but so far
it has worked well and saved me a LOT of time managing > 25 blogs that
all have the same settings (not in MU cause they all got started too
early and I haven't had time to migrate them into one install yet).
What it does is allow you to override anything in wp_options by
defining arrays of default values in a plugin file or functions.php.
This way you can just edit that one file that all sites share and
update it with SVN.

Pasted code: http://pastie.org/742625

The system basically lets you set up two arrays that override the
options on a blog. The first is full option overrides, where you want
to obliterate any existing version of the option and replace it with a
new value, the second is for complex array options where you want to
go in and carefully replace only certain keys in the array. I think if
you look through it the code is commented enough to be clear.

You wrap this stuff into a super-basic plugin and put it in
/mu-plugins/ folder so it will be loaded for every blog in the MU
install. If svn updating 10 places is too much for you you could make
a symlink to the plugin file in each of the /mu-plugins/ directories
to one central place where you store the actual file, that way you'd
only have to edit it in one place to affect all sites.

(PROTIP: Did you know you can use the /mu-plugins/ directory to
autoload plugins and hide them from the plugins screen, even if you're
not using MU? This blew my mind a little when I learned it at WCNYC)

The pasted code only works for individual site options, but if you
know you're PHP I'm sure you could add a third section of the
array/logic that would handle the update_site_option() MU side of the
options API. Sorry that its not actually packaged up as a plugin or
anything, but I use it as part of a bigger plugin that does lots of
stuff for me.

Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org

More information about the wp-hackers mailing list