Staging sites in WordPress 5.5
The release of WordPress 5.5 has ushered in a new era of responsible coding – developers can now easily check whether their plugin or theme is being used on a development, staging or production site with the function wp_get_environment_type().
WordPress has been encouraging good coding techniques and using staging and development sites has become more common. This means less cowboy coding which is awesome! The addition of this function, which allows any plugin or theme to check if their code is running in production or not, is further encouraging these good practices. There are many premium plugins and themes that know our staging environment and allow users to use them without having to worry about license keys, but we are thrilled that now all plugins and themes will have an easy and consistent way to check for this!
Since WP Stagecoach’s inception, we have always included a notice in the dashboard toolbar to alert users that they were working on their staging environment. This new function opens the doors for there to be new and innovative ways that users can find out if they are working on production or not.
WP Stagecoach lists the WP_ENVIRONMENT_TYPE as ‘staging’ and WP_ENVIRONMENT_TYPES includes ‘staging’ ‘development’ ‘test’ and ‘wpstagecoach’, and we still define ‘WPSTAGECOACH_STAGING‘ as true.
*update: we only provide the WP_ENVIRONMENT_TYPES define for staging sites that use PHP 7.0 or newer.