Skip to content

Instantly share code, notes, and snippets.

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 rolka/b5c37228f0ce56889f39dee7968b73f5 to your computer and use it in GitHub Desktop.
Save rolka/b5c37228f0ce56889f39dee7968b73f5 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