WordPress Staging Environment: Guide to Creating a WordPress Staging Site
When modifying a site, you need to ensure the changes made won’t affect the website negatively. Accidents happen, and sites crash – you’ll need a safe environment to test everything before publishing it online.
This is where the WordPress staging feature can help. By using it, you can modify your WordPress site safely and efficiently before deploying the changes to the live website.
This tutorial will show you how to create a staging environment for developing and modifying a WordPress site securely without affecting the original site. We will cover three options – using the built-in staging tool provided with our WordPress hosting, manual setup, and a plugin.
What Is WordPress Staging
A WordPress staging environment is a duplicate of the live website. It’s like a sandbox to test any changes you plan to implement to your WordPress website, such as updating themes or completely remaking the website, without harming the main production site.
Why Use WordPress Staging?
With WordPress staging, you can modify a site without the risk of crashing it or altering the functionality of the live website. This is important because even a small change that interacts with website functionality and design can affect the live website.
Keep in mind that a WordPress staging site is used for development purposes only and is not accessible by the public or search engines.
Usually, developers use multiple environments for the same website to ensure a site is running smoothly. A WordPress staging site is a bridge between the development website, where a developer writes code and performs initial testing, and the production site – the live website visitors see.
A staging environment is different from a testing environment. The testing environment helps ensure that each component does its job on its own. Meanwhile, the staging environment is for double-checking whether each component still works with everything else going on around it.
Furthermore, this also helps avoid downtime and poor user experience.
However, a WordPress staging site comes with its advantages and disadvantages:
- Risk-free environment. A safer environment to modify your site or try out major updates without risking the functionality of the live website.
- Early prevention of errors. Helps discover WordPress bugs, critical issues, and system crashes before the site goes live.
- Flexible setup. It’s possible to set it up locally or online, depending on your preferences.
- The best possible output. Allows you to build a better site since you can test everything thoroughly before launching it.
- Steep learning curve. For complete WordPress beginners, creating a staging site can seem challenging at first.
- Additional cost. Creating a WordPress staging site online may include additional plugin or hosting fees.
- Time-consuming. You will have to spend some time testing the changes on the WordPress staging site and redo the same changes to the live version of the site.
Run all of the possible use cases with the changes you’ve made. Only after you find no issues with them, push the changes to the production safe.
How to Set Up a WordPress Staging Site
There are three ways to set up a WordPress staging site – using your hosting provider’s built-in staging tool, manual setup, and a plugin.
Let’s go over each method.
How to Create a WordPress Staging Environment Using hPanel
The easiest way to create a staging site is to use a tool. It typically only requires a few clicks, making it fast and easy to set up even for beginners.
Some WordPress hosting companies offer a convenient staging tool, including Hostinger.
If you use Hostinger, follow these simple steps to create a staging site directly from hPanel, our own custom hosting control panel.
Note that the WordPress staging feature is only available for Business Shared Hosting plan and higher-tier plans. If your website runs on the Single or Premium Shared Hosting plans, create staging sites manually or use plugins like WP Staging.
- Open hPanel, and navigate to WordPress -> Staging.
- In the Staging tab, click on the Create staging button.
- You’ll see a pop-up window asking you to create a subdomain for the staging environment. Fill the blank field with the name you want for the staging site, and click Create.
- Creating this staging site can take up to 15 minutes to complete, depending on the size of the production website. Click Close to dismiss the confirmation message.
Once you see the name of your staging site in the list, follow the steps below to start using it:
- On hPanel’s staging page, navigate to the staging site list. Click Manage staging to start using it.
- You’ll land on the staging dashboard. Click the Edit staging button to access the WordPress admin area and start making changes to the staging site.
- Once you’re happy with the changes, publish them on the live website. Click Back on the staging site dashboard to go back to the WordPress staging page on hPanel.
- Go to the staging site list. Click the three dots icon next to the name of the staging site you just updated, and click Publish.
- A pop-up window will appear to inform that publishing this staging site will replace the live WordPress site with this newly-updated staging version. Hit the Publish button to confirm.
Important!This WordPress staging tool will also automatically create a backup of the current version of your live site, enabling you to revert to it if needed.
How to Create a WordPress Staging Environment Manually
Not all web hosts offer a staging site feature. If that is the case with your hosting provider, there are two other ways to create a staging site for WordPress – manually or using a WordPress plugin. In this section, we’ll learn how to manually create a staging site in WordPress.
Creating a staging site manually requires access to your hosting account’s control panel. It also involves configuring code and database settings, copying all the site files, and pasting them inside a new subdomain directory.
While this requires some technical knowledge, it allows you to make more complicated modifications.
Gaining technical knowledge doesn’t have to be hard or expensive – check out our tutorial on learning to code for free.
Here is a step-by-step guide that will show you how to create a staging environment in WordPress manually:
1. Create a Subdomain
We recommend creating a staging site in a subdomain. Doing so will make implementing changes in the staging site safer since it will be in a separate section from the production website.
So if the production environment is mywebsite.com, we can use staging.mywebsite.com as a subdomain URL for the staging environment. Note that it also involves creating a separate database for your subdomain.
Here’s how to create a subdomain for a staging site on hPanel:
- Open hPanel and navigate to Domains -> Subdomains.
- In the Create a New Subdomain section, enter the subdomain name.
- Doing so will automatically create a new folder in the home directory /public_html under the same name as the subdomain. If you want to use a custom name for the folder, tick the Custom folder for subdomain option, and click Create.
- Once you create the folder, you’ll see the subdomain in the List of Current Subdomains section.
Delete the staging site from this list when you finish using it.
2. Copy Your WordPress Website Files to the New Subdomain
The second step is to copy all your WordPress site’s files to the new subdomain.
To do so, use either a File Manager or an FTP client. The process is the same on both platforms.
In this tutorial, we will copy the live site files by using hPanel’s File Manager.
Note that hPanel provides a default File Manager and a beta version of the new File Manager. As the new one offers expanded functionality and higher stability, we will use this File Manager in the example below. However, if you’re more comfortable with the default File Manager, feel free to use it instead.
Follow these steps to copy the WordPress site files to your subdomain:
- Open hPanel and go to Files -> File Manager (beta).
- A new window will open, where you’ll have to click on the public_html directory of folders and files of your website.
- Next, move the files to public_html/staging/. Select all the folders and files inside the public_html directory except the subdomain folder, which in this case is the staging folder. Click the Copy icon on the top toolbar.
- A Copy pop-up window will ask you to choose a place to be the destination of the copied files. Select the staging folder, and click Copy.
- Once the copying process finishes, you’ll be automatically directed to the staging folder. Check to ensure all the website files and folders are there.
3. Make a Copy of the Database
Now you need to duplicate the production site’s existing database. Use phpMyAdmin to copy an existing WordPress database to the staging folder.
After successfully creating a duplicate database, make sure to tick all the permissions, so the staging website has the same access as the live website.
4. Configure the Subdomain’s config.php File
On the File Manager, navigate to the staging folder. In this example, open public_html -> staging -> wp-config.php.
- Double-click the wp-config.php file, and you’ll see the code. Scroll down until you find a line of code that says Database settings – You can get this info from your web host.
- Right above it, paste these two code snippets:
- Change subdomain to your staging subdomain name and domain to your live site domain. In this example, the URL will be http://staging.mywebsite.com.
- In the wp-config.php window, scroll down and find two lines of code that say DB_NAME and DB_USER.
- Change the name next to DB_NAME into your staging site’s database name and the name next to DB_USER into your staging site’s username.
The staging environment is now ready for use.
To deploy the changes you have made to the staging environment to the live site, copy the staging database into the live site database.
You must also copy all files from the staging folder to the live site folder.
How to Create a WordPress Staging Environment Using WP Staging
If setting up a manual staging site seems too complicated, using a WordPress plugin might be the right choice for you.
WP Staging is one of the best WordPress plugins for setting up a staging environment, so we recommend trying it first before going for any other plugins. It’s also a WordPress backup plugin – a function that goes hand-in-hand with staging purposes.
Note that while it’s simpler than creating a staging site manually, third-party plugins can take up hosting space. Also, a plugin may have limited control over your hosting server.
Follow the steps below to create a WordPress staging site using the WP Staging plugin.
1. Create a New Staging Site in a Subfolder
The easiest and fastest way to create a staging site with WP Staging is by using a subfolder. This option is a default setting for both the free and premium plugin versions.
If you want to create the staging site in a subdomain, you’ll need to use the premium version.
- Once you’ve installed the plugin, click the WP Staging tab on the WordPress admin sidebar, and navigate to Staging Sites -> CREATE NEW STAGING SITE.
- Enter the name of the staging site in the Enter Site Name (Optional) field. In this example, the staging site URL will be https://mywebsite.com/staging.
The Advanced Settings are only available for the WP Staging Pro users. This section provides more advanced features, like the ability to create a clone site and save it to a custom destination directory.
2. Choose Which Database Tables to Include and Exclude
In some cases, you may want to exclude specific files and database tables from the cloning process. This is because excluding heavy content, such as tables created by statistics plugins, can increase the cloning process’s speed.
You can make these adjustments in the Database Tables and Files sections of the WP Staging plugin.
Remember that you should not tamper with any additional settings if you’re unsure about what you’re doing. If in doubt, simply leave everything in default.
3. Start the Cloning Process
Once you adjust the Database Tables and Files, click the Start Cloning button.
This process may take a few minutes, depending on the website’s size.
Once WP Staging has finished creating a staging website, it will inform you about the completion and display the staging site’s URL. You can click the Open Staging Site button and directly access the newly created staging environment.
Another way to access the staging site is to navigate to WP Staging -> Staging Sites from the WordPress dashboard. There, you’ll see the list of the existing staging sites.
WP Staging allows you to create as many staging sites as you have space for.
Other WordPress Staging Plugins
Besides WP Staging, there are three more great staging site plugins on the market.
All-in-One WP Migration is not a WordPress plugin specifically created for staging, but its user-friendly migration tools are really helpful for creating a staging site.
This plugin migrates all WordPress website files, including the database, plugins, themes, and media files. It will bundle your files into one tidy file, making it easy to import and unpack at a different location. To do so, use its drag-and-drop feature in the destination website’s WordPress dashboard.
All-in-One WP Migration’s key features include:
- Bypass size restrictions. Upload or download the site data in chunks, overcoming file size restrictions.
- Find-and-replace during export. Find and replace operations on the database during the export process.
- Selective migration. Exclude specific files such as databases and spam comments from the export bundle. This way, you don’t have to copy your entire WordPress website, making the copying process more efficient.
- Automatic backups. Store a backup copy every time you export your site, which you can restore with a single click when needed.
- Multilingual. Choose from over 50 languages.
- Inclusivity compliant. Complies with the Web Content Accessibility Guidelines 2.1 AA Level, meaning this plugin is accessible for individuals with disabilities.
- Cloud storage support. Export files to cloud storage and import them from the target site. This is especially helpful if you have a large site, or your hosting provider has short timeout periods or file upload size limits.
All-in-One WP Migration is a free plugin. To get more advanced features such as cloud storage support, FTP support, and an upload size larger than 512 megabytes, you’ll need to buy a premium extension starting from $69.
Duplicator is also not a plugin specifically built for creating a WordPress staging website, but it’s very useful for this process.
This plugin clones, backs up, and migrates WordPress sites between hosts and domains, letting you easily duplicate a live site to a staging environment or the other way around. It does so by creating a package consisting of a ZIP file of your site’s database, content, plugins, themes, and other WordPress files.
Some of the best Duplicator’s features are:
- Preconfigured sites. Configure the production site and bundle it into a Duplicator package to avoid repetitive setups. This way, you won’t have to configure the theme, plugins, and content from scratch whenever you create a staging website.
- Recovery points. Quickly restore your system if you make any mistakes or perform bad updates.
- Scheduled backups. The premium version offers two backup options – immediate or scheduled backups, which are available daily, weekly, or monthly.
- Cloud backups. Back up to popular cloud storage such as Google Drive, Dropbox, and OneDrive for safe storage and convenient distribution.
- Supports large sites. Migration in a package form makes Duplicator capable of handling larger WordPress websites effectively.
- Drag-and-drop installs. Restore or overwrite the live site by dragging and dropping the staged site archive to the live site’s WordPress admin page.
- Direct server transfers. Directly transfer a package from a source server to the staging server. As a result, you won’t need to download the package to the local machine first, making the migration quicker.
There are two types of Duplicator plugins: the free version Duplicator Lite and the premium Duplicator Pro. These plugins are separate, so you can’t upgrade Duplicator Lite. If you want to use the Duplicator Pro, you’ll have to purchase it separately.
The Duplicator Pro comes with yearly plans starting at $69/year or a lifetime plan for $549.
WP Stagecoach is a WordPress staging plugin that uses a database merge feature to apply the changes made in the staging site to the live site. This means it doesn’t overwrite the database during the importing process, which is a good security feature.
It also lets users make changes to the live site while working on the staging site simultaneously.
This plugin is especially suitable for eCommerce sites or other websites that have their content or database regularly updated since users can troubleshoot or modify their site while keeping the content, orders, or registrations running.
WP Stagecoach’s most useful staging features include:
- One-click setups. Set up a staging site or push changes to the live site with one click. This is especially beneficial for non-technical users since they can skip the technical steps, making their work faster and easier.
- Password-protected staging site. Show the staging site to clients or teammates with a URL they can access from their own computers. Your content will be safe as this feature is password-protected.
- Selective migration. Select what changes you want to upload to the live site – the file changes, the database changes, or all of them. For example, if you only edit the CSS files, you can just import the file changes.
- Supports large websites. It also works well with multiple websites. This plugin can import site files in chunks, which is helpful if the server is slow.
- Recovery provision. When you make a mistake, WP Stagecoach provides a link to revert to the site’s previous version.
- Pre-migration changelog check. Keeps track of any changes you’ve made on the staging site, so you can check the newest changes before importing them to the live site.
- Progress messages. Instead of a spinning loading icon, you will see progress messages during the staging process. And if the process gets disrupted or times out, these messages can help you keep track of which step the plugin was on.
WP Stagecoach is a paid plugin with various plan options starting from $99/year.
WordPress staging environments provide you with a safe place to modify your website.
Unlike production sites, staging websites won’t be indexed by the search engines, and visitors won’t be able to access them. As a result, you don’t have to worry about making mistakes, crashing the site, and interrupting the user experience.
There are a few different methods to create a staging site for WordPress – using the staging tool provided by your managed WordPress hosting provider, manual setup, or a plugin. Evaluate your technical skills and choose a method you feel the most comfortable with.
Should you have any more questions, leave us a comment below.