Support Home > Developers > Staging Sites

Staging Sites

Safely use Jetpack with a staging site.

When you make a copy of your site for testing or development, Jetpack checks the WP_ENVIRONMENT_TYPE variable in the wp-config.php file. This is a feature used by many plugins and web hosts. If the variable is set to “staging” or “development,” Jetpack will turn off the option to move site settings to the test site. This helps protect the live site from any changes made in the test environment.

Note: This guide is for online staging sites. If you have a local offline development site, please follow the Offline Mode guide instead.

Manual process

In terms of a workflow between your production and staging sites, we’d advise the following:

  1. Migrate the database from your production to staging site.
  2. Make sure to flag the staging site with WP_ENVIRONMENT_TYPE
  3. At the “Safe Mode” prompt, click “Create a fresh connection”.
  4. Make your changes on the staging site.
  5. Migrate your changes back to your production site.
  6. When you access your WP Admin on your production site, click “Create a fresh connection” when the “Safe Mode” prompt displays.
  7. Since this is a “new” site, click the button “Create a fresh connection”. This will restore the old connection on the production site.

Automated process

Check if your hosting provider if they automatically set the WP_ENVIRONMENT_TYPE. If so, you can use the steps below:

  1. Clone to Staging.
  2. Staging site will enter “Safe Mode”.
  3. Create a fresh connection.
  4. Make changes to the staging site.
  5. Move to production.
  6. On production, you will get the “Safe Mode” warning again.
  7. Create a fresh connection since this is now a “new” connection compared to the staging environment.

Use staging mode

When your Jetpack site is accessed in staging for the first time, you will get a “Safe Mode” warning when Jetpack notices that the staging site is a copy of your production site.

There are three options:

  • Move Jetpack data from your production site to the staging site
  • Treat each site as independent sites, creating a fresh Jetpack connection
  • Decide later and stay in safe mode, best used when:
    • site is created only to perform a short test and will be deleted soon
    • when connection will be temporary so security features are not needed
The Safe Mode has been activated notification. 

User has option to "Stay in Safe Mode" or "Create a fresh connection"

Jetpack features that will not work in Safe Mode

Re-enable connection migration

If the site is using the WP_ENVIRONMENT_TYPE set to staging, but you need to enable connection migration anyway, use a filter:add_filter( 'jetpack_is_development_site', '__return_false);

The code can be added to any existing plugin or via Code Snippets or a similar plugin.

Still need help?

Please contact support. We’re happy to advise.

  • Table Of Contents

  • Contact Us

    Need more help? Feel free to contact us.