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?

link|improve this question

65% accept rate
feedback

2 Answers

up vote 7 down vote accepted

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...
}
link|improve this answer
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. – agileapricot Dec 19 '10 at 9:52
Not unless you write the php to parse the XML. ;-) – Denis Dec 19 '10 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 Dec 20 '10 at 15:00
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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