Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active April 4, 2020 15:33
Show Gist options
  • Save cliffordp/6250869 to your computer and use it in GitHub Desktop.
Save cliffordp/6250869 to your computer and use it in GitHub Desktop.
wp-config.php conditional for WP Engine Staging Sites *** Must be placed *after* the 'DOMAIN_CURRENT_SITE' constant is defined (near the bottom of wp-config.php)
<?php
# WP Engine Staging Sites Rules
### Must be placed *after* the 'DOMAIN_CURRENT_SITE' (for Multisite) or 'WP_SITEURL' (for non-Multisite) constant is defined (near the bottom of Production Server's wp-config.php)
//Multisite
if( defined('DOMAIN_CURRENT_SITE') && preg_match('/.staging.wpengine.com$/', constant('DOMAIN_CURRENT_SITE')) ) {
//Non-Multisite
//if( defined('WP_SITEURL') && preg_match('/.staging.wpengine.com$/', constant('WP_SITEURL')) ) {
### Enter wp-config.php constants here...
# Turn on WP_DEBUG
define('WP_DEBUG', true);
}
# End of Staging Site Rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment