WordPress Staging Environment: Guide to Creating a WordPress Staging Site

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.

Start A Free 7-day Email Course On WordPress

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.

Expert Tip

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.

Editor

Arnas Donauskas

Product Associate

Furthermore, this also helps avoid downtime and poor user experience.

However, a WordPress staging site comes with its advantages and disadvantages:

Pros

  • 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.

Cons

  • 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.

Expert Tip

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.

Editor

Arnas Donauskas

Product Associate

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.

Important! 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.

  1. Open hPanel, and navigate to WordPress -> Staging.
The Staging menu under the WordPress section on hPanel
  1. In the Staging tab, click on the Create staging button.
The Create staging button inside hPanel's Staging menu
  1. 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 a Staging path in the subdomain for the staging environment
  1. 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.
Message informing that the process of creating a staging environment can take up to 15 minutes to complete

Once you see the name of your staging site in the list, follow the steps below to start using it:

  1. On hPanel’s staging page, navigate to the staging site list. Click Manage staging to start using it.
The staging site list on hPanel's staging page
  1. 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.
The staging dashboard, where you can access the Edit staging button to start making changes to the staging site
  1. 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.
The Back link to navigate back to hPanel's staging page
  1. 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.
The Publish button for publishing the changes made in the staging site
  1. 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.
A confirmation message informing that publishing the staging site will replace the current live version of the site, and that a backup will be  automatically created.

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.

Pro Tip

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:

  1. Open hPanel and navigate to Domains -> Subdomains.
The Subdomains menu under the Domains section on hPanel
  1. In the Create a New Subdomain section, enter the subdomain name.
The Enter Subdomain field to be filled when creating a new subdomain
  1. 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.
  2. Once you create the folder, you’ll see the subdomain in the List of Current Subdomains section.
The List of Current Subdomains where users can see their existing subdomains

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:

  1. Open hPanel and go to Files -> File Manager (beta).
hPanel's Files section, where users can access the File Manager
  1. A new window will open, where you’ll have to click on the public_html directory of folders and files of your website.
  2. 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.
The content of the live site's public_html directory
  1. 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.
The content of the live site's public_html directory
  1. 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.

  1. 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.
A line that says "Database settings - You can get this info from your web host" in the staging site's wp-config.php file
  1. Right above it, paste these two code snippets:
define('WP_HOME','http://subdomain.domain.com');
define('WP_SITEURL','http://subdomain.domain.com');
pasting _define(_WP_HOME_,_http_subdomain.domain.com_)_ and _define(_WP_SITEURL_,_http_subdomain.domain.com_)_ to the staging site_s wp-config.php file
  1. 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.
  2. In the wp-config.php window, scroll down and find two lines of code that say DB_NAME and DB_USER.
  3. 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.
changing the DB_NAME and DB_USER in the wp-config.php file into your staging site's database name and 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.

WP Staging WordPress plugin banner

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.

  1. 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.
The CREATE NEW STAGING SITE button in the STAGING tab of WP Staging dashboard
  1. 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 Enter Site Name (Optional) field where users can enter their desired staging site name

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.

The Database Tables section in the WP Staging plugin dashboard

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.

The completion message you_ll find in WP Staging once the staging site is successfully created

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's list of 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.

1. All-in-One WP Migration

All-in-One WP Migration WordPress plugin banner

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.

2. Duplicator

Duplicator WordPress plugin banner

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.

3. WP Stagecoach

WP Stagecoach WordPress plugin banner

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.

Conclusion

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.

Was this tutorial helpful?

Author
The author

Nadia Maya Ardiani

Maya is a Digital Content Writer at Hostinger. As a website development and digital marketing enthusiast, she's keen to share her knowledge so people can thrive online. When she's not writing, you can find her watching sci-fi movies while eating ramen.