Skip to content

Instantly share code, notes, and snippets.

@HeikoMamerow
Last active February 9, 2021 17:31
Show Gist options
  • Save HeikoMamerow/baa676858b09cf46c7fa2796110acfa7 to your computer and use it in GitHub Desktop.
Save HeikoMamerow/baa676858b09cf46c7fa2796110acfa7 to your computer and use it in GitHub Desktop.
/**
* Set environment type.
*
*
* Use in your wp-config.php.
+ You can put it before /* That's all, stop editing! Happy publishing. */
*
* Background info: https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-function-in-wordpress-5-5/
*/
// Get host name.
$hostname = $_SERVER['SERVER_NAME'];
// Verify environment.
switch ($hostname) {
// Local server.
case 'local.test':
define('WP_ENV', 'local');
define('WP_DEBUG', true);
break;
// Development server
case 'development.test':
define('WP_ENV', 'development');
define('WP_DEBUG', true);
break;
// Staging server.
case 'staging.test':
define('WP_ENV', 'staging');
define('WP_DEBUG', false);
break;
// Production server.
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