Development wp-config.php setup for WordPress
Summary
A developer's setup for wp-config.php
files that will accommodate:
- Local development servers,
- Staging database servers,
- Production servers
Requirements
- WordPress
- At least two different environments.
How to Use
- Use this
wp-config.php
file instead of the default WordPresswp-config.php
file. It contains the logic to determine which files settings to use. - If you need to develop locally, copy/create a
wp-config-local.php
file and drop it in the WordPress install's root directory and configure database settings. - If you have a staging site, copy/create a
wp-config-staging.php
file and drop it in the WordPress install and make sure there's no activewp-config-local.php
file. - If you're using git, or another version control system, include
wp-config.php
in your repository, but you'll probably want to ignore both 'wp-config-local.php' and 'wp-config-staging.php' if you're deploying from your repository.
Why should I use this?
Really, if you're asking, you probably shouldn't. If you're struggling with switching between local and staging environments, this may help.
With great power, comes great responsibility.
Version
- 0.2.1 - Added wp-config-local.php to .gitignore, added JetPack to local dev
- 0.2.0 - Updated filenames
- 0.1.2 - Code tidying, shuffling, update docs
- 0.1.1 - Renamed files to better mimic our setup
- 0.1.0 - Initial release
Credits
- Based on Mark Jaquith's blog post entitled "WordPress local dev tips: DB & plugins". Thanks Mark!