fbpx

How To Set Up A WordPress Staging Site (2024)

No matter the size and complexity of your website, or even what platform you are using for your website, we always recommend creating a staging site.

A staging site is an exact copy of your main website. It can act as both a place for you to prepare updates and changes to your main website before making them live, as well as a sandbox of sorts, to test out new ideas that you haven’t completely decided to make public yet.

In this article, I’ll provide advice on how to set up and maintain a staging site specifically for WordPress.

What is a WordPress staging site and why do you need one?

As previously mentioned, a staging site can act as both a place for you to stage and prepare changes to your main website, as well as a sandbox to test out new ideas or features that you haven’t decided to make public yet.

At the very minimum, you might only need a staging site for WordPress to test out updates to plugins, themes, and the WordPress core software version. Testing these types of updates on a staging site first will help you avoid trying to run updates on a live website where you could potentially encounter an error that could take your website offline. This is the main reason why you’ll want a staging site.

In addition, if you have a medium to large website and want to continually test new designs and features, or work with multiple developers on these endeavors, then you might want to set up more than one staging website so you can test multiple different features at once without them conflicting with each other. Managing those sites and multiple projects could get confusing however unless you are keeping track of them or have a lead developer in charge of them.

Whether you only need one staging site or several, the process for creating them is largely the same, with some nuances depending on the platform where you are hosting your website. Therefore I have provided advice for two different approaches in this article.

Option 1: Create a staging site with a managed hosting service (our preferred method)

If you are not running your WordPress site on a server from a managed hosting provider, then you should consider moving where your site is hosted immediately! If you don’t already know, managed hosting companies provide WordPress-specific hosting solutions. These services are not just for small websites, there are enterprise-level offerings out there as well.

One great feature managed hosting providers all offer is the ability to quickly clone your main website and set up a staging site. I call it the “1-click staging site”, but all these hosting providers may call it something different.

Since there are so many different WordPress hosting providers out there, I have linked to some relevant documentation and resources below on how to set up staging sites on some of the most popular WordPress hosting providers.

At On Press, we are loyal customers of WP Engine. When it comes to staging sites, they allow you to easily log in to your WP Engine dashboard and create a staging site, in fact they allow you to create several. Our favorite method of approach is to copy the “production” environment (aka your live/main website) to your staging site. This will create an exact copy of your main website. You can then log in to this new staging site, make all the changes you need, and then finally just copy this environment to your production website when you are ready to go live with your changes. It’s the cleanest hosting solution approach we have encountered to test and deploy updates to your main website, especially for non-technical site owners.

Staging site documentation & resources for some of the most popular managed WordPress hosting providers:

Option 2: Create A WordPress Staging Site Manually On Your Own Self-Hosted Server

As previously mentioned in this article, in 2024 and beyond I would really recommend against self-hosting WordPress on your own server. There are so many cost, performance, and time disadvantages to that approach which makes utilizing a managed WordPress hosting service a no-brainer.

Having said that however, and in the interests of covering all bases, I have provided a step-by-step guide below on how to manually create a staging site on your own server.

Here are the steps:

  1. Before you get started
  2. Set up a new domain, server & database
  3. Back up your main WordPress website
  4. Copy your WordPress site files to your staging server
  5. Important WordPress settings for a staging site
  6. Copy and sync data between your main site and your staging site

1. Before you get started

If you are not familiar with web development principals this whole process may be a bit more involved than you are used to. You may want to consider hiring a WordPress developer for this process.

2. Set up a new domain, server & database

As with your main website, you will also need a hosting server for your staging site. My recommendation here (and I think this is very important) is that you use the same service provider as your main website to host your staging site, and make sure all of the server settings exactly match your main website (except for bandwidth/traffic limits, since you will not be sending any traffic to this site). I have run into too many issues in the past when tests on a staging site went well only to fail on the main website, the reason being a discrepancy in a server setting.

In addition to the server, you will also need to make sure that you have PHP installed, and that you can set up a database using MySQL or MariaDB. Again, these are features that your hosting provider should be able to assist with.

You can log in to your hosting service provider dashboard to see what options are available for hosting another website. Just keep in mind the minimum hosting server requirements to run WordPress. At this point you only need to set up the hosting server, so make sure not to install WordPress or upload any files to your new staging server yet. We’ll get to that part later in this guide.

You will also need a domain name to use for your staging site. This can be anything you like. Your hosting provider should be able to provide a temporary URL for your new hosting server, which will be just fine for your purposes. Or you may want to create a subdomain such as “staging.yourdomainname.com” and point it to your staging server, so that it is easy for yourself and/or your team to locate the staging site URL. Your hosting provider can assist on how to point a domain name to your hosting server.

3. Back up your main WordPress website

Before you configure anything further on your new staging server, you will need to create a full backup of your main website.

There are two parts to backing up a WordPress site. The first is all of the files and folder structure of your WordPress installation, including all the core WordPress files, your themes, plugins, and media files. These can all be found in the root folder of your hosting server, which you can access by logging in to your server using FTP software such as Transmit. The second part is the database which you’ll typically access via an online interface called phpMyAdmin. Your hosting provider will be able to provide you with login information and advice on how to access both of these.

There are several ways to back up a WordPress site, and since it’s a pretty deep subject in some ways, I think it’s best for me to refer you to the official documentation from WordPress.

4. Copy your WordPress site files to your staging server

Once you have fully backed up your WordPress site you will be ready to copy everything over to your new staging server.

Again, there are several ways to do this.

The simplest method involves the following steps:

  1. Edit the wp-config.php file to point to your staging database
  2. Upload the entire WordPress folder structure to your staging server via FTP
  3. Upload the database to your staging database using phpMyAdmin
  4. Run a search and replace in phpMyAdmin to replace your main website URL with your staging website URL.

As simple as those steps might be, the main problems you may run into will be when trying to upload the database and running search and replace methods to update the URLs. It’s for this reason that you may find using a plugin to back up and copy your website is the best approach. You can find more details about this in the official WordPress documentation.

5. Important WordPress settings for a staging site

Once you have found the best approach to back up and copy your website to your staging site, you’ll want to immediately make sure that you do not allow search engines to index or crawl this site. The most secure way to do this is to implement a robots.txt file, a “noindex” setting, as well as password-protecting the site at the server level. Your hosting provider should be able to help you with that. You should also log in to your WordPress staging site dashboard, go to “Settings > Reading” select the checkbox next to “Discourage search engines from indexing this site and click “Save.

6. Copy and sync data between your main site and your staging site

At this point, you can now use your staging site to test WordPress versions and plugin updates, test out new themes, and more. However, you’ll likely want to keep your main website and your staging site somewhat in sync, so that you have the very latest content on your staging site.

To update your staging site you’ll only have to update the Media, Themes, and Plugins directories. You won’t have to worry about copying over the WordPress core software files again. In addition, you’ll want to manually download and upload the database file again.

There are also several plugins available that can help with this process. Again, you can refer to the official WordPress documentation on this matter.

What about copying from your staging site to your main website? Well, if you are self-hosting WordPress, I would highly recommend against this approach. Too much can go wrong to mess up your main website if you try to copy over files and databases from your staging site. This is why I am a 100% proponent of using a managed WordPress hosting provider for your site.

In Summary

I hope this article has provided you with some sound advice on what is involved in setting up a staging site, as well as backing up your main website.

If you need any assistance from a real-life WordPress web developer on matters like this, you might want to consider subscribing to On Press.

Filed under…

Leave a Reply

Your email address will not be published. Required fields are marked *