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?
I’ve answered a similar Question. Basically:
create a Dropin plugin at the root of
wp-content
namedinstall.php
inside
install.php
, create a new version of the pluggable functionwp_install_defaults()
remove all unwanted defaults and customize at will, like:
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 emptywp_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 filewp-content/install.php
. It will run only once (based on this Answer by @bainternet) and after WP has been installed.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.
https://github.com/wycks/WordPhing/
Inside
build.xml
you will see some php options like the following which are run during install: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:
On the other hand you can always try Duplicator. A really fine plugin that gives you plenty of extras.