I downloaded the latest version of WordPress (3.5) and created a custom theme. I plan to upload and install it for multiple clients. Is it possible to customize the default settings such as not have the sample post, page, and comment added when it's installed? And set the default theme that is activated?

I looked at upgrade.php and schema.php and it looks like that is where the sample post, page, and comment is being added but I cannot find where the default theme is being chosen. Is there an article on how to edit these files or some tips on what to do?

  • You could setup a starter WordPress installation and then export the database tables for use to start your client's sites.
    – shea
    Dec 29, 2012 at 8:56

4 Answers 4


I've answered a similar Question. Basically:

  • create a Dropin plugin at the root of wp-content named install.php

  • inside install.php, create a new version of the pluggable function wp_install_defaults()

  • remove all unwanted defaults and customize at will, like:

    • update_option('template', 'your-theme');

    • update_option('stylesheet', 'your-theme');

    • update_option('current_theme', 'Your Theme');

    • update_option('my_theme_options', $theme_options_array );

    • auto-activate some bundled plugins

  • bundle everything into one package (WordPress files and content files: Theme, Plugins, install.php)

  • now, whenever you run a install, the Dropin will be processed and the new site starts up with your pre-configurations

I did some more tests in my development environment and updated the Gist from the other answer with a working install.php.
Now it contains the function wpse_4041_run_activate_plugin($plugin) (to activate bundled plugins) and an empty wp_new_blog_notification() (which is another pluggable and prevents WP from sending a notification email about the site installation).

I used the theme F8 Lite for testing. Most of the code is an adaptation of the original script (default Page, Post, Comment, Category, Blogroll). And at the end, my custom commands (change theme, set theme options, activate plugins, set plugin options).

Check the comments on the file.

Not sure if it's the best method, but inside the theme functions.php file I put this script that will delete the file wp-content/install.php. It will run only once (based on this Answer by @bainternet) and after WP has been installed.

// If the option doesn't exist and the install script is there, delete it
if ( wpse_25643_run_once( 'my_custom_install_2013' ) )
    if( file_exists( WP_CONTENT_DIR.'/install.php' ) ) 
        unlink( WP_CONTENT_DIR.'/install.php' );

 * Check if option exist
 * @param string $key
 * @return boolean
function wpse_25643_run_once( $key )
    $test_case = get_option( 'run_once' );

    if ( isset( $test_case[$key] ) && $test_case[$key] )
        return false;
        $test_case[$key] = true;
        update_option( 'run_once', $test_case );
        return true;

Related Q&A with another method that doesn't use install.php:
Initialization Script for "Standard" Aspects of a WordPress Website?


I'm working on a Php build script using Phing that installs WP along with some defaults (themes/plugins and custom code), it's still a work in progress.


Inside build.xml you will see some php options like the following which are run during install:

     //remove Hello Dolly 

    //remove default hello world post

    //remove default sample page

    //remove default Mr.Wordpress comment
      wp_delete_comment( 1, true ) ;

ps. I have not tested this on the latest release or on linux.


Setup your install as you want it then use something like http://infinitewp.com/ to duplicate the install to your other locations for the other websites. This is what we do for a base install for all our projects.

Alternatively instead of doing a fresh WordPress for each site, take a backup of your existing WP install and import it on the new hosting account. Then copy all the files using FTP, update the database settings in wp-config.php for the new database and you'll be all set. Bit more involved than InfiniteWP but it means you don't have to pay for the plugin.


What you need to do is open the wp-includes/default-constants.php and change the following line (you will find it at the end of the document) to your theme's folder name:

if ( !defined('WP_DEFAULT_THEME') )
        define( 'WP_DEFAULT_THEME', 'twentytwelve' );

On the other hand you can always try Duplicator. A really fine plugin that gives you plenty of extras.

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.