A WordPress staging site is like a sandbox. It’s where you can try out all kinds of tweaks and changes without risking breaking your production site. And, as opposed to running a local development site, your WordPress staging site is using the exact same hardware as your live site, which means anything that works on the staging is pretty much guaranteed to work on your live site.
There’s a reason so many quality managed WordPress hosts offer staging sites. But what if you’re one of the people who doesn’t have access to a host that offers staging sites? Are you doomed to a life of making changes to your live site?
No! You’re not, my friend. And in this post, I’m going to show you two different ways that you can create your very own WordPress staging site.
First – I’ll show you the easy free plugin that helps you create a staging site. Then, for the masochists, I’ll show you the manual method that I personally used to create my own personal staging site.
Let’s dive in…
Defining Some Terminology: Push vs. Pull in Staging Sites
Before I give you the guide, I want to set up some basic staging terminology that’s going to come in handy during the tutorial part.
Push – pushing the changes from Site A to Site B. For example, if you push from staging to live, you’d be overwriting your live site with the version of your site on your staging site.
Pull – the opposite – pulling changes from Site B to overwrite Site A. For example, if you pull from live to staging, you’d be overwriting your staging
The solutions that I’m going to talk about make it easy to pull your live site to your staging site. But they don’t give you an option to push those changes back.
They’re still super helpful, just not as helpful as the staging sites offered by managed WordPress hosts because you’ll need to manually make the changes on your live site once you test them on your staging site.
Article Continues Below
How to Create a WordPress Staging Site Using a Free Plugin
Up until not that long ago, there weren’t any popular free plugins to help you create a staging site (that’s why I did it manually!). That was true until René Hermenau came along with his awesome WP Staging plugin.
It helps you create a complete staging version of your site with just a few clicks. It’s by far the easiest way to create a staging site if your host doesn’t offer one.
It also ensures that your staging site is only accessible to you – only users who are logged into an admin account can see the staging site, and it’s similarly hidden from search engines.
How to Use the WP Staging Plugin
As I said, WP Staging is super easy to use. Once you install and activate it, you’ll get a new WP Staging tab, complete with some gnarly warnings. I’ve used this plugin on three sites now with no issues and the reviews at WordPress.org are stellar…but YMMV. Definitely backup before going any further.
If you’re ready to go ahead, all you need to do is hit the Create new staging site button:
Give your staging site a name and then you’re free to hit Start Cloning. You can manually choose some files not to sync – but you don’t need to do anything unless you want to:
The plugin will work its magic, which might take a minute or two depending on the size of your site:
And once it’s finished, you can click the button to log in to your staging site:
You can log in with your normal admin username and password. This check is just there to ensure that your staging site is not available to the public.
And that’s pretty much it! You now have a staging site in a subfolder of your site based on the name you gave your staging site when creating it:
As I mentioned, the only major downside of WP Staging compared to using a host’s staging service is that you can’t easily push back changes from your staging site to your live site – you’ll need to make them manually.
How to Manually Create a WordPress Staging Site
To manually create a WordPress staging site, you basically need to duplicate your entire site on a subdomain.
Files are easy enough to move via cPanel File Manager or FTP, so the only tricky thing you’ll need to handle is your database and serialization issues. That is, your database will initially contain references and links to your live site – you need an easy way to update those references to point towards your staging site.
That need is why Delicious Brains created an awesome plugin called WP Migrate DB.
In the free version, you can manually export the database from your live site, run a find and replace and fix serialization issues, then import that to your staging site (and vice versa). The pro version can automate this entire process but comes in at a somewhat hefty $99 for a single site license.
I’ll run through this process quickly below – but I actually already wrote a detailed guide showing you how to use WP Migrate DB. If you need help, every step is identical (just don’t do the 301 redirect at the end!).
How to Set Up Your Staging Site Manually With WP Migrate DB
Step 1: Add a subdomain (e.g. staging.yourdomain.com). Then copy (not move!) all of your files over from your live site to that subdomain.
Step 2: Use WP Migrate DB to export your database from your live site and update it for your staging site:
Step 3: Create a new database for your staging site and import the .sql.gz from WP Migrate DB via phpMyAdmin.
And that’s it! You have a working staging site. Again – if you need the instructions in more detail, you can find a full guide here.
Don’t Forget to Make Your Staging Site Private
One thing you definitely don’t want to happen is for Google to index your staging site. That’s a ton of duplicate content…
To avoid that, I recommend two things:
First – go to Settings → Reading on your staging site (seriously – don’t do this on your live site) and check the box to Discourage search engines from indexing this site:
Second – consider using .htaccess to password protect WordPress on your staging site.
Can You Push Back to Your Live Site Using This Method?
If you get the pro version of WP Migrate DB, you’ll be able to at least easily push your database back to your live site. But I haven’t found a way to automate pushing back file changes (if you find one – please let me know!
Your best bet is to either:
- Manually make changes on your live site
- Reverse the whole process. That is, copy files from your staging site to your live site.
Personally, this is the setup I’ve been running and, while not ideal, it’s not too much of a pain to just do it manually.
Are These Methods Better Than Your Host’s Staging Site?
No, most host’s staging sites are much simpler to use and give you more flexibility. So if you want a staging site and can swing the cost, I recommend signing up for a host with staging like SiteGround’s top tier, WP Engine, or one of the many other managed WordPress hosts out there.
Now over to you – have you tried to set up your own WordPress staging site? Do you have any tips or tricks that differ from what I’ve found?