Skip to content

Instantly share code, notes, and snippets.

@oscarnascimento
Last active January 29, 2018 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save oscarnascimento/17e98e84012e9d11311fea10ff7eda3a to your computer and use it in GitHub Desktop.
Save oscarnascimento/17e98e84012e9d11311fea10ff7eda3a to your computer and use it in GitHub Desktop.
Wordpress wp-config.php MUTIPLE ENVIRONMENT
/*------------------------------------------------------------------------------------------
* 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