Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 8 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...
}
share|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
    

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.

share|improve this answer

Your Answer

 
discard

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.