Hello.
Today, I realized that after cloning the LIVE site to STAGING, the following constants are no longer defined at the top of wp-config.php.
<?php /* BEGIN KINSTA DEVELOPMENT ENVIRONMENT - DO NOT MODIFY THIS CODE BLOCK */ ?>
<?php if ( !defined('KINSTA_DEV_ENV') ) { define('KINSTA_DEV_ENV', true); /* Kinsta development - don't remove this line */ } ?>
<?php if ( !defined('JETPACK_STAGING_MODE') ) { define('JETPACK_STAGING_MODE', true); /* Kinsta development - don't remove this line */ } ?>
<?php /* END KINSTA DEVELOPMENT ENVIRONMENT - DO NOT MODIFY THIS CODE BLOCK */ ?>
Our development processes rely heavily on these constants when we want to customize plugin behavior depending on the environment.
We do define ‘staging’ in wp-config.php with
.define(‘WP_ENVIRONMENT_TYPE’, ‘staging’ );
but this is done manually, and we need to wait until the cloning process is over. Cloning and DB search and replace take time, especially in larger sites.
Ideally, the newly created STAGING wp-config.php should already declare the environment type, so there is no gap in which STAGING is still considered as being “live”.
Is there a plan to get those constants back?
Is there a bulletproof way to detect a non-production environment during site cloning?