Automatically enable custom theme, plugins and default content on installation?

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?

Related posts

Leave a Reply

2 comments

  1. 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...
    }
    
  2. 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.