A staging site is an independent clone of your live production site that can be easily created to test plugins, themes, and custom code. You can also copy the staging site back to the live site at any time after making changes. Each WordPress install at WP Engine can have its own staging site.
There are a few best practices to keep in mind when working with staging sites:
- There is no server side caching in place on staging sites, so ensure anything that could conflict with the cache is tested Live as well
- Backups for Staging are enabled and work exactly like our Live backups, you can read more about them here
- Only the current year’s /uploads and /blogs.dir are copied. However, our system will look at the production site to find an image if the staging site does not have a particular image copied over.
- There are some plugins that should not be used in the staging area, automation around tweeting or posting are good examples
Plugins that may have issues in the staging area are generally connected to third-party services or validate licenses through their domain. In this case, you may need to purchase two licenses to ensure similar functionality between your live and staging sites, or add the [installname].staging.wpengine.com domain to the license. You can also contact the author of your plugins for more information.
How to create a staging site
To create a staging environment, follow these steps:
- Go to your WordPress Dashboard (yourdomain.com/wp-admin or installname.wpengine.com/wp-admin).
- Click on the WP Engine logo on the side bar located at the top left corner.
- Select the “Staging” tab
- Click “Copy site from LIVE to STAGING.”
Your site will now be copied to the staging area and a green box will pop-up showing the status of the task. Please note that the duration of this process will depend on the size of your site. The larger the site, the longer it will take to copy.
If you already have a staging area, clicking the “Copy site from LIVE to STAGING” button will overwrite it. Please be very careful when copying to staging.
The URL structure for every staging area appears as follow: http://account_name.staging.wpengine.com
You can access the staging area by simply logging into the admin for your live site, i.e.: http://installname.wpengine.com/wp-admin
All existing users and user meta information will be copied from live to staging and everyone can log into the staging site with the same credentials used in the live site.
The staging area can only be seen by users that have the staging URL. Robots.txt is set to “disallow all” for the Staging area.
Access the staging site’s database
You can access to the staging site database in the same way that you access the live site’s database. In the User Portal, click PHPMyAdmin for the proper install. Then, once inside PHPMyAdmin, select the database labeled “snapshot_installname”. This is your staging database.
Note: The database “wp_installname” is the database for the live site. Any changes you make to this database will affect the live site.
Please read over this article for additional information on accessing your database:
To access your staging site’s files via SFTP, you will use the same process as you would on your live site, except you’ll use the staging user credentials that are setup in the User Portal.
You can also edit any existing SFTP user’s settings and change the “Environment” to “Staging”. For additional information on logging in via SFTP, please see this article:
Copying the staging site to your live site
If you’ve made changes to the staging site and want to push those changes to the live site, you can do so with the click of a few buttons.
Please Note: When pushing changes from staging to live the file system from staging does not overwrite the live file system but instead merges with the live file system. This means any updated files in staging will be updated on live after a push, but any deleted files in staging would not be deleted in live.
After logging into your live site’s /wp-admin click the WP Engine button on the top left hand side. Then, click the “Staging” tab.
You will now see a black button labeled “Copy site from STAGING to LIVE”. Click that button. It appears as follows:
Then, you will be prompted with a dropdown menu that appears as follows:
This dropdown menu will allow you to select all, none, or specific database tables from the staging area to the live site. If you select all tables, any new posts, pages or users changes made to the live site during your work in the staging area will be overwritten.
If you want to push all changes, except for pages, posts and users to your live site, select all database tables except wp_posts, wp_postmeta, wp_users and wp_usermeta. If you push no database tables, only changes to theme files, core WordPress files and plugin files will be pushed to the live site.
This covers the essential functions of the staging site. If you need any additional support, please check our Support Garage for relevant articles or use the “Support” button from within your User Portal to contact our technical support team.