WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large MultiSite network, and each page is designed a bit differently. I'm looking to write some custom code to automate the setup of a new blog as much as I can.

Things I'm looking to do for every new blog:

  • Activate a theme
  • Create some new pages (contact, about us, etc.)
  • Add and configure some widgets
  • Etc.

I'm completely willing (even eager) to write custom code to make this automation happen. However, I'd like to leverage as much existing code as possible. What recommendations do you have in order to make this happen?

I know that I can use wp_insert_post() to insert posts and pages, but how should I go about activating a theme, enabling widgets, etc.?

share|improve this question

You'll want to hook into wpmu_new_blog. You can see the args you can pass it here (no codex right now...). That last $meta arg can take a lot of different settings.

You also might look into the WPMU New Blog Defaults. It doesn't seem to do everything you want, but it might at least contain some good examples for how to use that hook.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.