6

I'm using wordpress for a large non-profit with many sites. I'd like to decrease the amount of installation steps for the people setting up their sites. Is it possible to make a WP install that automatically activates the plugins, themes and default content I choose?

2 Answers 2

8

Sure. wp_install_defaults() is a pluggable function. (As are wp_new_blog_notification() and wp_upgrade(), in case you ever need to override those too.)

# in wp-config.php
if ( defined('WP_INSTALLING') && WP_INSTALLING ) {
  include_once dirname(__FILE__) . '/wp-content/install.php';
}

# in wp-content/install.php
function wp_install_defaults($user_id) {
  global $wpdb, $wp_rewrite, $current_site, $table_prefix;
  // do whatever you want here...
}
4
  • Great thanks. Now the killer question is could the sample content be in the form of a wordpress import/export XML file? It would save me having to write it out in PHP and I could update the file often. Thanks. Commented Dec 19, 2010 at 9:52
  • Not unless you write the php to parse the XML. ;-) Commented Dec 19, 2010 at 10:18
  • @firefusion: That's a good follow-up question. Probably worth to ask it: "How to import WP XML file automatically?". I think the default XML importer still ships with wordpress core but I'm not sure.
    – hakre
    Commented Dec 20, 2010 at 15:00
  • Done :) wordpress.stackexchange.com/questions/5674/… Commented Dec 20, 2010 at 15:31
0

If you don't want to write any PHP code, you could create the default wordpress installation and then follow the instructions for Moving WordPress. Instead of moving the files and you just copy them instead and don't delete the existing database after exporting it. This would transfer all the settings and content (as its all stored in the database) and still leave the default installation for you to repeat the process with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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