Copy Environment
If you have made changes to an environment and want to copy (or “push”) those changes to another environment you will need to use the User Portal function called “Copy Environment”.
The following video shows how to copy an environment:
Copy Environment
WP Engine’s Copy Environment tool allows you to easily copy the source environment to any other destination environment on the same account.
If you are copying a multisite network, we also recommend reading the article Multisite Deployment Best Practices first. If you need to copy an older checkpoint, use the backup and restore functionality instead. Read more about this here.
The Copy Environment process includes:
- A new restore checkpoint created of both source and destination prior to copying.
- Options to include, partially include, or exclude the database.
- An automated search and replace from source domain to destination domain on all included database tables.
- A restore checkpoint of the destination environment after copying.
NOTE
To prevent any visual discrepancies, downtime or missed orders, we suggest that you enable a maintenance page on the Source and Destination environment before initiating the Copy Environment process. Maintenance mode can be enabled through a plugin, or by triggering the default WordPress functionality.
To initiate a copy:
- On the Sites page, select the Source environment
- Be sure to select the correct source environment, where content should be copied from.
- Click Quick Actions at the top right
- Select Copy Environment
- Destination environment: Select the environment to overwrite (where content will be copied to)
- Any environment on the account may be selected as the destination, even if they are within separate Sites.
- Learn how to add a new environment here.
- Include: Select one of the following options-
- All database tables and file system – Fully overwrite the destination with the source content.
- Includes the entire files system. See what the file system includes.
- Includes all database tables. See what the database includes.
- Specific database tables and file system – This option may be useful if you have a large website or if you only need to test updates on a handful of subsites.
- Includes the entire files system. See what the file system includes.
- Includes the specified database tables. See what the database includes.
- File system only – This option is typically recommended when copying to production as the database will be fully excluded. Read more here.
- Includes the entire files system. See what the file system includes.
- Excludes all database tables. See what the database includes.
- All database tables and file system – Fully overwrite the destination with the source content.
NOTE
If the database is included, a search and replace will be run automatically to update the domain name.
On a multisite network this search and replace may look different than expected, so we recommend reviewing this article beforehand.
- Enter email address(es), separated by commas, to be notified at when the copy is complete
- Click Review and confirm
- Review the details of the copy process, such as the source and target environments, database include options, and notification email(s)
- When ready to start the process, click Looks good, copy the environment
You will receive an email at the address provided when the copy process is complete. Large environments may take a while. Once a copy has been initiated, do not make additional changes to either environment.
Database Include Options
Each copy process includes the entire file system, but copying the database is optional.
The file system includes: media, images, stylesheets, plugin files, scripts, wp-config.php, etc.
The database includes: all posts, pages, users, custom post types (EX: WooCommerce orders), and certain settings. It’s possible for the database to also contain theme and plugin settings. This will vary based on the asset so if there are questions, reaching out to the author directly would be best if you aren’t sure.
When the database is included, a search and replace will automatically be run to update the source domain to the destination domain. Learn more about this process here.
If the environment is a multisite network, this search and replace will work similarly, but the results may look different than expected. We recommend reviewing this article before copying.
All database tables
NOTE
Copying the database to production can be destructive, so we advise only doing so with caution.
Copying the database is destructive, meaning that the entire database will be overwritten if the entire database is included in the copy.
- Tables that exist on both the source and destination will be overwritten on the destination.
- Tables that exist on the source but do not exist on the destination will be added to the destination.
- Tables that do not exist on the source, but exist on the destination will be left as-is on the destination.
Only the file system
Only includes the entire files system. File system copy is fully destructive. Everything will be overwritten on the destination. If a file is not on the source, it will be removed from the destination. There are no file system exclusions.
No database information will be copied to the target environment. The database will remain as-is.
Specific database tables
NOTE
Copying the database to production can be destructive, so we advise only doing so with caution.
This option allows you to include specified database tables, excluding others. Only tables that exist on the source can be selected.
- Selected tables that exist on destination will be overwritten on the destination.
- Selected tables that do not exist on the destination will be added to the destination.
There might be scenarios where you only want to copy certain database tables. For example:
- You’ve installed a theme or a plugin and only want to copy the tables related to it.
- You’ve added content to the target environment since the last copy and you hope to preserve that data when pushing back.
You can do this by choosing only specific tables that you want to copy. Ultimately you may need to refer to your plugin or theme support if you’re not sure which tables hold data you wish to not overwrite.
When selecting this option you can either choose specific database tables, or you can use “select all” tables, then search or scroll through the list of tables and exclude certain ones.
NOTE
If you’re using a custom database prefix, these would read yourprefix_tablename instead of wp_tablename.
To exclude pages and posts, do not select the following tables:
_posts
_postmeta
To exclude users, do not select the following tables:
_users
_usermeta
If you are using WooCommerce, you may want to exclude certain order data or user information from the deployment. In this case, do not include the following tables:
_posts
_postmeta
_woocommerce_order_items
_woocommerce_order_itemmeta
When using WooCommerce, we recommend enabling High Performance Order Storage, which separates orders into dedicated tables. This can simplify deployments by allowing those tables to selected or deselected. Learn more here. When High Performance Order Storage is enabled, posts and postmeta are not used. Instead, the orders tables to exclude are:
_wc_orders
_wc_order_addresses
_wc_order_operational_date
_wc_orders_meta
For more information on deploying WooCommerce, see WooCommerce Best Practices.
Copy Database to Production
It is typically not recommended to copy a database to a Production environment, as the database will be rewritten entirely with the Staging/Development contents. This destructive process can cause the loss of important data, such as new orders or users.
If posts or pages were added to the Staging/Development environment, the easiest solution is to use the WordPress Default Export/Import Tools to manually migrate that content to Prod. If more specific export parameters are necessary, then WP All Export has more customizable export options.
Alternatively, if you have added content to Production but need to push the Staging/Development database for some other reason, the content will need to be exported from Production before the copy, then imported back to Production after the copy has completed. The WordPress Default Export/Import Tools can be used for this as well as WP All Export for more customizable export options.
If you are using a theme that stores settings in the database, it would be best make the changes on Production and leverage the Preview Site theme feature as well as our Backup system.
If you are deploying a WooCommerce site, we recommend reviewing WooCommerce Best Practices first.
Copy Tips
- User Portal 301/302 redirects, SSL certificates, custom cache exclusions, Nginx rules, and other custom WP Engine server configuration options.
- These items will not be copied using the Copy Environment process. These rules exist if added manually, and in most cases will not cause issues when excluded from a copy. The WP Engine Support team is happy to manually copy over any custom rules if necessary, by request.
- We suggest that you enable a maintenance page on the Source environment before initiating the Copy Environment process. Maintenance mode can be enabled through a plugin, or by triggering the default WordPress functionality.
- This is done to prevent any visual discrepancies, downtime or missed orders. Maintenance mode can be enabled with a plugin or by leveraging default WordPress functionality.
- To speed up a copy, reduce the scope of the content.
- Reduce or offload storage to reduce overall size. Learn more here.
- Optimize the database to minimize database size. Learn more here.
- Specific plugins or themes can be duplicated by using the file system instead of performing a copy process. Plugins are stored in
wp-content/plugins
and themes can be found inwp-content/themes
. Files can be accessed by downloading a full or partial backup, by using SFTP, or with SSH Gateway.
NEXT STEP: Learn about the WP Engine backup and restore system