Does anyone know how to handle removing the /wp/
in the URLs when trying to switch to a different environment from Dev using Bedrock?
Here’s what I have in functions.php. The is_wpe()
stuff is WP Engine specific since pushing to and from staging on WP Engine overwrites wp-config.php both directions.
///////////////////////////////////////
// WP Stage Switcher (WP Engine)
// github.com/roots/wp-stage-switcher
///////////////////////////////////////
if( !function_exists('is_wpe') && !function_exists('is_wpe_snapshot') ) {
function is_wpe() {
return false;
}
function is_wpe_snapshot() {
return false;
}
}
$envs = [
'production' => 'http://www.example.com',
'staging' => 'http://example.staging.wpengine.com',
'development' => 'http://dev.example.com'
];
if( is_plugin_active('wp-stage-switcher/wp-stage-switcher.php') && (is_wpe() || is_wpe_snapshot()) ) {
if( is_wpe() ) {
$env_label = '<span style="color:#46b450;">Live</span>';
} elseif( is_wpe_snapshot() ) {
$env_label = '<span style="color:orange;">Staging</span>';
} else {
$env_label = '<span style="color:#469ecd;">Development</span>';
}
define( 'WP_ENV', $env_label );
}
define( 'ENVIRONMENTS', serialize($envs) );