Skip to content

Instantly share code, notes, and snippets.

@andrezrv
Created April 21, 2014 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrezrv/11132305 to your computer and use it in GitHub Desktop.
Save andrezrv/11132305 to your computer and use it in GitHub Desktop.
Basic model of a wp-config.php file for different stages
<?php
/**
* Load different configuration files for different stages.
*/
if ( file_exists( $local_config = dirname( __FILE__ ) . '/local-config.php' ) ) {
require $local_config; // Configurations for your local stage only.
define( 'WP_STAGE', 'local' );
} elseif ( file_exists( $staging_config = dirname( __FILE__ ) . '/staging-config.php' ) ) {
require $staging_config; // Configurations for your testing stage only.
define( 'WP_STAGE', 'staging' );
} else {
define( 'WP_STAGE', 'production' );
}
// Your usual code here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment