Working and making updates on a live WordPress site can be dangerous. And it’s not a matter of whether you’re a skilled enough coder to do it. That’s where staging environments can help – learn how in this article.
There are any number of things that could go wrong when you issue a new update to a plugin, or attempt to code a new feature in by hand.
Anything you do that affects the code of a website presents an opportunity for something to go wrong on the frontend. And that’s not something your clients or their visitors will be too understanding of.
This is why we use staging environments. If you’re in the business of developing WordPress sites, then staging environments need to be part of your process.
In this article we’ll look at the benefits of using staging environments, when you should use them, and how you can easily get started with them – inside and outside of WordPress.
Continue reading to learn more, or jump ahead using these links:
Let’s kicks things off with…
The Pluses of Using a Staging Environment for Your WordPress Site
A staging environment is typically hosted on a private subdomain of your WordPress site for the purposes of building and testing.
Why do it this way? There are many reasons.
Consider these:
A blank canvas from which you build a new website or create new pages you plan to add to an existing website. This way, your clients, managers, or anyone else who feels like weighing in before it’s appropriate to do so are prohibited from seeing your work until you’re ready to share.
Test new WordPress, plugin, or theme updates on a mirror image of a live website. Updates are first handled on the staging site. Upon confirming that no issues are present, you can move forward with them on the live site.
Implement code or design updates on a mirror image of a live website. This is especially helpful if you’re attempting to code a new feature on your own and are nervous about the repercussions of something breaking as a result.
Clone a live website to save time developing a similarly structured WordPress site from scratch.
Stage a website pre-launch in order to conduct QA and testing. Team members, clients, and other project stakeholders are then given a link to the frontend of the staged site for review.
Test new coding techniques. You can use a copy of a website that already exists or use a sample website to test out theories or to hone your implementation process before adding it to your workflow. You can also use this as a training platform for new developers on your team.
Build basic prototypes for the purposes of demonstrating a suggested design or feature to the client. This way, you don’t have to try to explain the idea you have for a landing page or a new checkout process or whatever it is you’ve thought of. Instead, you mock it up here and give them a way to experience it first-hand and avoid any potential miscommunications.
There are also a whole lot of other benefits in using staging environments for these purposes:
- They lend to safer coding practices, in general.
- They give you privacy to build and update websites without a bunch of prying eyes checking in on you.
- If something wonky gets introduced into the code, it won’t take down the live website or prevent complete access from the WordPress admin, which would reflect poorly on you as well as your client (if visitors were to notice).
- They save time you would otherwise spend repairing the white screen of death or troubleshooting other issues caused by cowboy coding on the live installation.
- They protect a live website’s search ranking as you prevent bots from encountering an error-ridden website, an offline website, or one that’s in transition and sending mixed signals.
Bottom line: staging sites are meant to maintain the integrity of the live sites displayed to visitors, allowing you to safely and privately work behind the scenes.
How to Set up a Staging Environment for Your WordPress Site
A staging environment setup largely depends on what its purpose will be.
If you intend on using it as a training or experimentation platform, you have freedom to do whatever you want.
If you intend on using it for a different, specific purpose, such as implementing WordPress updates, revising design and code, or adding new pages, then what sits in staging needs to be identical to the website.
This means having the same:
- Hosting
- WordPress version
- PHP version
- Theme version
- Plugin versions
- Any configurations that are essential to how the site works on the live server
To set up a mirror image of your WordPress site in the staging environment, you can use one of three means: the manual method, through a managed WordPress host, or by using a WordPress plugin.
We’re gonna take a look at all of these, starting with…
#1 The Manual Method
Like it sounds, the manual method is very hands-on, and consists of the following steps:
- Save a backup of your WordPress site.
- Create a subdomain from your control panel where this staging site will sit.
(This will automatically create a subfolder on your WordPress site.) - Install a fresh copy of WordPress on it.
- Copy files from your current site into the new WordPress installation.
- Copy your database from the current site over to the new installation.
Refer to this post for full details, instructions, and screenshots on how to set up a staging environment manually.
#2 Through Managed WordPress Hosting
While the manual method has you working within the control panel to set up a staging environment, Managed WordPress Hosting handles the job for you.
This is without doubt, the speediest and most stress-free method of the three. It cuts out pretty much all of the work on your part.
It also means you’ll incur the cost of procuring the services any host provides. But chances are good if you run a site or agency, you already know the value of managed hosting. Of course perspective is unique, and it’s always up to an individual to decide.
Most managed WordPress hosting plans with the providers above come with one-click or pre-made staging areas.
Creating a password-protected staging site on your server generally requires little more than logging into your hosting account and proceeding to the appropriate page.
Pushing updates from a staging site to the live server is beyond easy with this option. Just one click and your staging environment will go live.
Here’s an example of how the process works with WPMU DEV Hosting.
Creating a Staging Site Through WPMU DEV’s Hosting
This process could not be simpler or quicker.
1. Starting in The Hub―WPMU DEV’s unified command center―click on the Sitename for which you’d like to create staging.
2. Click on the Hosting header, then the Staging header.
3. Click the blue Start button from the Setup your staging environment screen.
You’ll see the bouncing ellipses while it does its magic, generally in under a minute. Then you’ll get a popup that the sync to staging is complete, taking you to the Staging options page.
Stage creation in four clicks and one minute; no glitches or gaffes.
Done, fini, finalizado, finito, samapt.
Fewer clicks than words in that last sentence, and less time than it took to google the other language equivalents.
Not only did we accomplish an otherwise burdensome task quickly and easily, everything we might want to do for or with our staging site is accessible directly from this Hub page.
Move Staging to Production? Check. Reset or Delete the current Staging environment? Mmmhmm.
Manage Database–Manage Files–Reset WP? Yes–sir–ree. All of these settings and more are gathered together here in Staging options.
I wasn’t kidding when I sang the praises of managing staging environments in this way. Brewing a single cup of coffee in the morning takes more time and effort than this.
If you are more of a DIY-er, or don’t have managed hosting because you’re saving your benjamins, continue on for the WordPress plugin method.
#3 Using a WordPress Plugin
For those of you who would like an option that requires less work on the server, without the expense of managed WordPress hosting―you can use a WordPress plugin.
We’re highlighting two options here, and really, the difference boils down to your comfort level in setting up WordPress Multisite, and budgetary considerations.
Without Multisite: All-in-One WP Migration Plugin
All-in-One WP Migration is a plugin with multiple uses. It works as a backup plugin, a migration plugin, and as a staging plugin.
AIO WP Migration comes with newbie-friendly functions that allow you to migrate your WordPress website with little to no technical knowledge or experience.
Let’s go through how to use this for staging.
1. Install and activate All-in-One WP Migration on the WordPress site you want to export.
2. Navigate to the plugins’ menu on the sidebar, and click Export.
Optional: From the Advanced options dropdown arrow, you can select any variables you don’t want exported/replaced. (This can help reduce file size.)
3. From the EXPORT TO dropdown, select File.
Give it time to compile the data (how long depends on the size of the site files you are exporting).
4. Once compiled, you’ll get a size-fluctuating green box with the filename and file size. Click on that to save it to your computer, then click the red CLOSE button.
6. Next, log into the WordPress site where you want the installation of your staging environment to be, and install the same plugin.
7. From the plugins’ menu on the sidebar, click Import.
Note that if the file you want to import is larger than the maximum allowable amount, AIO WP Migration offers some options on increasing this.
Basically, these are: purchase the paid version of their plugin; contact your hosting provider for a limit increase; or do some coding yourself (examples of which they provide―see above link).
8. Upload the file you just saved to your machine, then click the green PROCEED button on the warning popup.
Note: The file you downloaded should be wherever your default download folder is, with a .wpress extension. However, you can also easily grab it from the plugins Backups section, which is accessible via their dashboard side menu, beneath Export and Import.
After the brief process runs, you’ll get a successful import message, confirming the process is complete. You now have a mirror image of your live website sitting on your staging subdomain.
To push your staging environment (and any changes made there) live, simply repeat the process in reverse.
Next, we’ll look at doing this with multisite.
With Multisite: Shipper Plugin
One of the best perks of creating a staging environment this way is that you get to keep your live WordPress site and its private and non-indexable staging subdomain within one WordPress installation.
So, you don’t have to move back and forth between your control panel and various WordPress instances to manage both.
Shipper is a powerful, one-stop-shop migration tool. It handles multisites, subsites, and single site migrations.
You can do package or API migration, exclude certain files and folders, find and replace links―all with a centralized dashboard providing clear explanations and estimated times prior to doing any migrating.
We already have a fantastic, detailed tutorial on the blog for migrating a multisite to a single site using Shipper Pro, so I’ll refer you to that instead of repeating it all here. (Shipper is pro only at this time, but you can do a free trial if you want to give it a go, risk-free.)
As always, it is wise to create a site backup prior to migrating. I can recommend two options for this task: Snapshot (also covered by the same money-back guarantee & free trial as Shipper Pro), and Updraft Plus (which comes in both free & premium paid versions).
If you run into any issues using Shipper, you can reference its full documentation. Or if you’re a WPMU DEV member, avail yourself of our highly rated, expert tech support, standing by 24/7/365 to help with ALL things WordPress.
To move the staging environment to the live server, you’ll simply need to reverse the process. There will be no need to create new sites or subdomains. Simply clone the subdomain to the live site once you have finalized everything and verified that content is good to go.
Exit, Stage Left
Once you’ve completed the migration, you can go ahead and get to work on your staging environment. All settings, files, and databases will mirror what exists on the live site.
Think about all the time you’re going to save by using staging environments in your WordPress development workflow going forward. Heavens to Murgatroyd!
Whether it’s preventing unwarranted feedback from clients, or implementing updates/coding new features in a separate testing space, staging environments preserve the integrity of your live WordPress site until you’re 100% sure revisions can be reflected on the frontend.
It’s definitely the way to go!
Editor’s Note: This post has been updated for accuracy and relevancy.
[Originally Published: June 2018 / Revised: January 2022]