Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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