Last active
January 29, 2018 16:32
-
-
Save oscarnascimento/17e98e84012e9d11311fea10ff7eda3a to your computer and use it in GitHub Desktop.
Wordpress wp-config.php MUTIPLE ENVIRONMENT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------------------------------------------------------ | |
* WORPDRESS MULTIPLE ENVIRONMENT | |
*-----------------------------------------------------------------------------------------*/ | |
//GET HOSTNAME INFO | |
$hostname = $_SERVER['SERVER_NAME']; | |
//VERIFY WHICH ENVIRONMENT THE APP IS RUNNING | |
switch ($hostname) { | |
case 'development.dev': | |
define('WP_ENV', 'development'); | |
define('WP_DEBUG', true); | |
break; | |
case 'staging.mywebsite.com': | |
define('WP_ENV', 'staging'); | |
define('WP_DEBUG', true); | |
break; | |
case 'www.mywebsite.com': | |
define('WP_ENV', 'production'); | |
define('WP_DEBUG', false); | |
break; | |
default: | |
define('WP_ENV', 'production'); | |
define('WP_DEBUG', false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment