How to use a WordPress Staging Site

In the article 3 Things you can do with a WordPress staging site we described the advantages of using a WordPress staging site. It' a must-have, once you consider how it can dramatically improve the way you apply updates to your WordPress site. After absorbing that article you would have a conceptual idea of what a staging site is. Now we'll take it a step further and explain how to use a staging site, by providing you with a practical workflow you can apply starting today.

Step 0 - Setup your staging site

Before you can begin using this workflow, you'll need to have a staging site. Naturally, the setup process will differ depending on where your WordPress site is hosted, but at the end of the day, a staging site is just a brand new, fresh WordPress site. The difference between a normal WordPress site and a staging site is actually semantic: A staging site is intended to be destroyed, again and again, as you begin to make changes to your production site. Our deluxe WordPress hosting plan provides an integrated staging site which smooths out the workflow, but nevertheless for this process you need a secondary site wherein site changes will be staged. Once you've created a staging site, you should be able to reuse it, hence you need to perform this initialization step only once.

Our deluxe WordPress hosting plan provides an integrated staging site.

-- Ghost Host

Step 1 - Always begin with a clean slate

The first step begins when you are about to make changes to your WordPress site. What you want to do is replace the contents of your staging site with a fresh clone of your production site. The goal here is to wipe out whatever is in the staging site and replace it with whatever you currently have in your production WordPress site. This creates a clean slate to start from. Once again, the actual steps for doing this will depend on your WordPress hosting solution, but we shamelessly argue that we've made this process super simple; A few button clicks and you're done.

Wipe out the staging site and replace it with a copy of your production WordPress site.

-- Ghost Host

One thing worth mentioning is that while you do in effect want to clone your production site, you do need to make one adjustment (if it's not done automatically for you): You need to change the domain name in the administration panel. This is because WordPress is... we'll just say it's sensitive to the domain name setting. Two websites cannot have the same domain name, so the staging site will need to have its own. As an example, when you create a staging site with our hosting solution, it automatically gets a randomly-generated domain name.

Step 2 - Isolate your changes using the staging site

Now that your staging site had been initialized with an up-to-date copy of your production site, you are ready to begin making changes. Perhaps you want to change the theme, or add/remove plugins. Whatever the case may be, what this process suggests is that instead of making the changes in your production WordPress site, you make the changes in the staging site. In doing so, the changes are isolated from your production site; Customers would not see broken or half-baked updates. Have you ever updated WordPress itself and ended up with broken plugins? Well, this process suggests that you update WordPress itself in a staging site, so that you have the opportunity to test everything out first.

Customers would not see broken or half-baked updates.

-- Ghost Host

During this step, make a list to keep track of what you changed. You can use this as a check-list for the remaining steps.

Step 3 - Test your changes

Now comes the fun part. After you have made all your desired changes within the staging site, it's time to test the staging site to make sure your changes had the intended outcome. Obviously, the steps you perform to test the changes will depend on the nature of the changes. But the good news here is that not only are your changes isolated from the real WordPress site, any steps you take to test the changes are also isolated.

Well... there's a caveat to that. You may recall that the staging site has a different domain name than the production site. Sometimes, this can affect how you make and test changes. A good example is payment processing. If you're making changes regarding a payment processor (or any other integration with external APIs), the domain name really matters. So you may need to take extra steps to configure your staging site to connect to the test environment of external APIs.

Step 4 - Deploy your changes to production (aka. Here be the dragons!)

After thoroughly testing your changes, you should have greater confidence in the changes you made. Now it's time to apply the changes to your production environment. We have to once again state that how this is done depends on your WordPress hosting solution. But one thing that is common among solutions is that you must be very, very careful when you apply the changes made in staging to your production site. We'll use an example to illustrate the risk involved.

Let's say you and a friend decide to write a business proposal together. Your friend takes a first crack at it and sends you a draft. You then take the draft and add on to it. Meanwhile, your friend gets a creative impulse and also makes a bunch of edits. If you're keeping track, you know there are now two independent copies of the document. After you finish improving your copy, you send it to your friend, who promptly copy-pastes the document and impatiently selects Yes when asked to overwrite the file. Did you notice what just happened?

Your friend now only has the changes that you made. Everything else is gone.

And this is exactly the same kind of disaster that can happen if you overwrite the content of your production WordPress site when pulling your changes from your staging site. In short, you should almost never copy your staging database over to your production site. More likely than not, doing so will result in losses. Don't do it.

You should almost never copy your staging database over to your production site.

-- Ghost Host

Remember how we suggested that you take notes describing all of your changes? You can now use those notes to redo your changes, but applying them to the production site. This method, although slow, can be an effective way to ensure that your changes are applied to your production site in a safe way.

Now that we have put the fear of God in you, we bring some comforting news. If you have a recent backup of your production WordPress site, that would mitigate many of the risks that can come from incorrectly applying your changes to production. In fact, we highly recommend you manually make a backup of your production site just prior to deploying your changes from staging to production.

Next steps

We hope that you have learned more about how to use a WordPress staging site. We think you'll agree that using one is a great way to safely make improvements to your WordPress site. Our online staging site functionality is just one of many powerful features included in our deluxe WordPress hosting plan. If you'd like detailed instructions about everything discussed in this article, take a look at our documentation.

We briefly touched on using a WordPress backup as a mitigation strategy against damaging your production site. If you haven't read our article on backups, click here to learn more. You won't regret it! If you're hungry for more information about what our deluxe WordPress hosting solution can do for you, the best place to start is at our home page right here.