Support » Fixing WordPress » Is there a way to pre-configure wordpress installs?

  • I build several sites on wordpress, every week. For almost every site I do the same thing once the website is running:

    • Enable pretty permalinks.
    • Delete the example page, post, and comment (Twice, because of trash)
    • Disable comments/pingbacks/discussion features
    • Change the meta description (even if it is just blank temporarily, to avoid “Just another wordpress site”).
    • Install a custom theme via FTP.
    • Install several “starter pages” as well as basic navigation (Home, About, Contact)
    • Install a variety of plugins via FTP (.zip file).

    What would be the best way to do a one-time setup, after WordPress has been installed but before it has been modified? Does WordPress have any sort of functionality for customization default options like this?

    If I could edit the default options in a config file and stick that next to wp-config, or even inside wp-config, that would be excellent. Otherwise, I’m considering learning some UNIX scripting and makinga program to do this for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Technically, one could write a simple plugin that does a one-click configuration. If you’re comfortable following PHP code (I assume you are if you build several WordPress sites each week) then you can dig through the WordPress core and find the code that updates the permalinks structure, and the code that changes the comments settings, and the code that deletes a post, etc, and then create a plugin that would do that.

    In fact, I’m now thinking of writing this myself, because I hate having to go through all those steps when launching a site. But before you or I even lift a finger to write it, we both should look to see if one already exists.

    I found this article about automating the install, although it is not as easy as I hoped, it would allow a single PHP script to be fired prior to the install (and I assume there’s a hook we can call after the install, too).

    Automating WordPress customizations – the install.php way

    On the other hand, we can customize the install screen and perhaps add additional options, eg a checkbox to enable comments/pingbacks, or to start with permalinks enabled.

    Then again, I don’t think anything I am planning on automating would require access before the installation – so a plugin should work as well. On the other hand, plugins are generally designed to be configured once they are installed – the exact opposite of what I want.

    Maybe that install script is the best option. It’ll take a bit of work, though.

    Brilliant! Thank you for finding and sharing a solution to your question.

    You are right that the trouble with a plugin is that it takes that additional time to upload it and activate it.

    Based on my reading of the article you found, the solution would actually be pretty simple. Just make a file named install.php, and make a function in that file to replace the normal wp_install_defaults function. And leave it empty:

    function wp_install_defaults( $user_id ) {
       // nothing to do here because we don't want any defaults!

    By leaving this function empty, you prevent WordPress from making the default first post and comment. But rather than leave it empty, you can just execute functions to change all the settings that you want to change, such as the permalink settings.

    The bigger roadblock for this would be if you use one-click installs like many web hosts provide, in which case the installation process is complete before you have an opportunity to upload this install.php file. If you install manually by uploading the files for the WordPress core, then just include your install.php.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is there a way to pre-configure wordpress installs?’ is closed to new replies.