I learned the hard way that when making structural changes to my site, I needed to know how to set up a WordPress staging site.
Losing data from what you think may be simple changes is a good teaching experience. I like to post new content and not have to do it a second time.
What is a Staging Site?
A staging site is a copy of your live production website into a location accessible for testing new features or functionality.
Since it's a copy, you don't need to worry about shutting your website down due to a mistake. Most often, this happens when making changes to your themes and plugins.You can incorporate the new changes and then test them along with existing content. If everything works as planned, then you can merge these changes into your live site without having to manually re-make them.
If testing does not go well, you can delete the staging site and start over with a fresh copy of your live site.
It sounds simple, and it is. The huge benefit is that staging websites can save you a ton of grief if something goes wrong.
How Do You Create a Staging Site?
I’m sure there are manual ways to do this, but I’m focused on adding content to my site and wanted an automatic solution. For it to be automated, your Managed WordPress web hosting provider needs to offer staging as part of their package.
I host my WordPress site with WPX Managed WordPress Hosting, and they do indeed provide an automatic solution for staging.
A couple of the pre-requisites for this to work are:
Deploy the New Staging Instance
The first step is to open my website service management screen. It lists all of my currently hosted domains, with an option at the bottom to create staging.
That button opens up a new window that asks you to choose the original site you would like staging.
I then clicked on the deploy staging instance button, clicked proceed on the confirmation message that displayed, and finally received the news that my wp staging process had started.
The process to set up a staging will copy all of my site's WordPress install files. Along with the site files, the process will copy any backend MySQL databases.
Once the process completes, I received another confirmation message on the screen.
The new staging site shows up on my management screen as another website. The process will automatically create a subdomain on your existing WordPress website. One extra option appears, allowing me to merge to live when finished.
I can then login to my staging site the same as I do with my live site. The username and password are the same as my live site.
One difference after logging in to your admin functions is the following message displayed on your dashboard.
Blocking the search engines is something you want to happen with a staging site. A staging site is only temporary. Once finished with it, you will want to delete it. You want the search engines to keep indexing your live site, and you don’t want any confusion between the live and staging instances.
There is standard functionality in WordPress for this setting. It’s in the “Reading Settings,” and toward the bottom of the screen, you can check or uncheck the “Search engine visibility” option.
The WPX Hosting process to create the staging site automatically set this option. So it was not something I had to remember to do.
Merge the Staging Site to the Live Site
Once finished with your staging site, you have two options: Merge the staging changes to your live site or just deleted the staging site.
I would not recommend leaving your staging site deployed for an extended time. You risk the search engines ignoring your request to index the staging site contents. You also risk making too many changes in both sites and risk the merge to live, eliminating content you wanted to keep.
WPX Hosting is very clear on how the merge to live process works. However, if you change a post in both the live site and the staging site, the merge process will not combine the two. One of the copies will lose, and you’ll have to correct it.
WPX Hosting maintains daily, automatic backups of your site. The merge to live process allows you to make another backup if the process does not go well. I’ve used it several times already without any issues.
Once you have merged your staging site back into the live website, make sure to delete the staging site. The process does not automatically do this for you.
Additional Information on How to Set Up a WordPress Staging Site
The complete details and a video showing these details can be found in the following WPX article: “How to Use the WPX Staging Area.”