3 Ways to Set up a WordPress Staging Environment (Using hPanel, a Subdomain, and a Plugin)

3 Ways to Set up a WordPress Staging Environment (Using hPanel, a Subdomain, and a Plugin)

One of the reasons why WordPress is the world’s most popular CMS is its vast number of useful features.

For example, the WordPress staging feature enables you to modify your site safely before deploying changes to the live website. This prevents any crashes or errors that might occur on your main website and increases its uptime.

This tutorial will show you how to create a staging environment for developing and modifying a WordPress site. We will cover three options – using the built-in staging tool provided with our WordPress hosting, manual setup, and a plugin.

A WordPress staging environment duplicates a live website. It’s like a test environment to experiment with changes you plan to implement to your WordPress website, such as updating themes or completely remaking the site.

Why Use WordPress Staging?

With WordPress staging, users can experiment and modify their websites without the risk of altering the functionality of the live site. Let’s take a look at a few specific use cases for the WordPress staging environment:

WordPress Core Updates

It’s common for a WordPress site to crash after a core update. This may happen due to outdated plugins or themes that don’t match the newest WordPress core version.

The WordPress staging feature can catch this initial crash, preventing downtime on the live site.

If you want to double-check your WordPress version, head to hPanelWebsite section → Security. Note that if you use another hosting control panel, the steps may vary.

The WordPress section on Hostinger's hPanel shows your current WordPress version.

Theme and Plugin Updates

Themes and plugins can also crash your website at any time due to incompatibility issues. To prevent a crash on the live WordPress site, update themes and plugins on a staging website first.

Similarly to the WordPress version section, you can check plugin or theme versions via hPanel. It’s also possible to update them if necessary.

The WordPress section on Hostinger's hPanel shows all currently installed plugins and their versions.

WordPress Core Customization

It’s possible to modify WordPress core files to expand the functionality of a website. However, doing this on a live site is risky, as one wrong line of code can crash the entire website. Meanwhile, making such changes on a staging site won’t affect the live website and can be reverted easily.

Expert Tip

A staging environment is different from a testing environment. A testing environment helps ensure that each website component does its job independently. Meanwhile, a staging environment is for double-checking whether each component works with everything else inside a website.

Editor

Arnas D.

Product Associate

However, staging sites comes with certain disadvantages as well:

  • Steep learning curve. Creating a staging site can be challenging, especially for people without a technical background.
  • Additional cost. The process may include plugins or hosting fees.
  • Time-consuming. Users will need to spend some time testing changes on a WordPress staging site, then redo them on the live site.

Expert Tip

Keep in mind that a WordPress staging site is used for development purposes only and won’t be accessible to visitors or search engines. As a result, you can test out all possible use cases with the changes made and push the changes to the production site only after you find no issues.

Editor

Arnas D.

Product Associate

How to Set Up a WordPress Staging Site

Let’s begin with the quickest method – using Hostinger’s built-in staging tool method.

How to Create a WordPress Staging Environment Using hPanel

The most convenient way to create a staging site is to use a specialized tool. With hPanel, it only takes a few clicks, and you can have a staging environment running in a couple of minutes.

Important!The WordPress staging feature is only available with Business Shared and higher-tier hosting plans. For Single or Premium Shared Hosting users, create staging sites manually or use a plugin.

Create a Staging Environment

Follow the steps below to create a staging environment on Hostinger’s hPanel:

  1. Open hPanel, and navigate to WordPressStaging.
The staging button's location is in the WordPress section on Hostinger's hPanel.
  1. In the Staging tab, hit the Create staging button.
The Create staging button on hPanel
  1. Fill the blank field with the subdomain name you want for the staging site, and click Create.
The Create button on the Create Staging Environment window on hPanel.
  1. Depending on the production website’s size, it can take up to 15 minutes to create a staging site. Click the Close button to dismiss the confirmation message:
The confirmation message that your staging environment is being created.

Manage the Staging Site

The staging site will appear in the hPanel list after a while. After that, follow these steps:

  1. On hPanel’s staging page, navigate to the staging site list and hit the Manage staging button near the preferred website.
The Manage staging button on the Staging section.
  1. You’ll be redirected to the staging dashboard. Click the Edit staging button to access the WordPress admin area and start making changes.
The Manage staging button on the Staging section.
  1. Once ready, publish all the changes on a live website. For that, refer to the next section.

Publish the Website

The final and most important step is to push all the changes from the staging website to the live one.

  1. Go to the staging site list. Click the three dots icon next to the staging website and press Publish.
The Publish button o the staging site list.
  1. Read the disclaimer and hit the Publish button to confirm. Give it about 15 minutes to complete.
The disclaimer on publishing the staging copy of your website.
  1. Hostinger’s WordPress staging tool will also automatically create a backup for the current version of the live site. This will allow you to revert all the changes if needed.
The Revert button on the staging site list.

That’s it – the staging site is now published.

How to Create a WordPress Staging Environment Manually

If your hosting provider doesn’t offer a staging site feature, you can create a staging site manually. While this method requires some technical knowledge and is more time-consuming, it gives you full control over the whole staging creation process.

Create a Subdomain

Before we begin, we recommend creating a staging site in a subdomain. Doing so will make implementing changes in the staging site safer since it will be separate from the production website.

For example, if the production environment is domain.tld, then use staging.domain.tld as a subdomain URL for the staging environment. Note that it also involves creating a separate database for your subdomain.

  1. Start by opening hPanel and navigating to the DomainsSubdomains section.
The Subdomains button under the Domains section.
  1. Enter the subdomain name and click Create. Doing so will automatically create a new folder in the home /public_html directory.
The Create button under the Subdomains section.
  1. If you want to use a custom name for the folder, tick the Custom folder for subdomain option, specify the custom name, and click Create.
The process of creating a new staging subdomain on hPanel. Custom folder for subdomain option is checked
  1. You’ll see the subdomain in the List of Current Subdomains section.
The Subdomains section on hPanel with List of Current Subdomains section visible

Copy Your WordPress Website Files to the New Subdomain

The next step is to copy all your WordPress site’s files to the new subdomain.

To do so, use either File Manager or an FTP client. The process is similar on both platforms. In this tutorial, we will copy the live site files using File Manager.

  1. Open hPanel and go to FilesFile Manager.
The File Manager button under the Files section
  1. Navigate to the public_html directory of your website.
  2. Next, copy the files to /public_html/staging/. Select all the folders and files except the staging folder and click the Copy icon on the top toolbar.
The Copy button in File Manager.
  1. Select the staging folder, and click Copy.
The COPY button on the Copy window.
  1. Once the copying process finishes, you’ll be automatically redirected to the staging folder.

Make a Copy of the Database

The next step is to duplicate the production site’s existing database. To do so, follow these steps:

  1. Navigate to the WordPressDashboard section and check which database your main website is using.
The database name's location in the WordPress dashboard section on hPanel.
  1. Then, navigate to the DatabasesMySQL Databases section and create a new database for the staging website.
The Create button on the MySQL databases section on hPanel.
  1. Next, open the DatabasesphpMyAdmin section, find the live website’s database, and hit Enter phpMyAdmin.
The Enter phpMyAdmin button on the phpMyAdmin section on hPanel.
  1. Inside phpMyAdmin, select Export and hit Go to download the SQL file.
The Export button on the main phpMyAdmin interface view.
  1. Then, open the DatabasesphpMyAdmin section again and hit the Enter phpMyAdmin button near your staging database.
The Enter phpMyAdmin button that is near the staging database.
  1. Inside phpMyAdmin, choose Import, select the downloaded SQL file, and hit Go to import the database.
The Import button on the main phpMyAdmin interface view.

Give it a few minutes, and all database tables will appear on phpMyAdmin.

Configure the Subdomain’s wp-config.php File

  1. On File Manager, open public_htmlstagingwp-config.php.
  2. Scroll down until you find a line of code that says Database settings – You can get this info from your web host. Then add the following code:
define('WP_HOME','http://staging.domain.tld');
define('WP_SITEURL','http://staging.domain.tld');
The home and site URL lines located in the wp-config.php file.

Make sure to change the staging.domain.tld part to your staging subdomain.

  1. In the wp-config.php window, scroll down and find the DB_NAME, DB_USER, and DB_PASSWORD lines. Then, change the database name, username, and password to match your staging site’s database information. Once done, save the changes.
The database name, username, and password in the  wp-config.php file.

The staging environment is now ready for use.

Deploy the Changes

To deploy the changes to the production environment, follow these steps:

  1. Export the staging website’s database and import it to the production database via phpMyAdmin. Keep in mind that it’s only possible to import to an empty database. Thus you will need to clear the production database, as shown in the example below.
The Drop option in the phpMyAdmin view with all database tables selected.
  1. Open the File Manager and navigate to the public_htmlstaging directory. Choose all files except for wp-config.php, and copy them to the production website.
The Copy button on the Copy window on File Manager.
  1. Lastly, select Replace.

Once the copying process finishes, you’ll be automatically redirected to the production folder.

How to Create a WordPress Staging Environment Using the WP Staging Plugin

If you are looking for an easier way to create a staging website, consider using a WordPress plugin.

WP Staging is one of the most popular WordPress plugins for setting up a staging environment. It’s also a WordPress backup plugin – a function that goes hand-in-hand with the staging process.

The WP Staging plugin banner

Follow the steps below to create a WordPress staging site using the WP Staging plugin.

Create a New Staging Site in a Subfolder

Using a subfolder is the easiest and fastest way to create a staging site with WP Staging. This option is set by default for free and premium plugin versions. However, if you want to create a staging site in a subdomain, opt for the premium plugin version.

Once you install the WordPress plugin, follow the instructions below:

  1. On the WordPress admin sidebar, click the WP Staging tab and hit the CREATE NEW STAGING SITE button.
The main WP Staging plugin view
  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://domain.tld/staging.
The Overview section on the WP Staging plugin page

Note that Advanced Settings are only available for WP Staging Pro users. They provide more features, like creating a clone site and saving it to a custom destination directory

Choose Which Database Tables to Include and Exclude

Sometimes, it’s worth excluding specific database tables or files to speed up the cloning process. This is because some plugins can create heavy content. Make these adjustments in the WP Staging plugin’s Database Tables and Files sections.

The Files section on the WP Staging plugin page

If you’re unsure about any of the settings, we recommend leaving the default options active.

Start the Cloning Process

Once you adjust the Database Tables and Files, click the Start Cloning button. Depending on the website’s size, this process may take a few minutes.

Now, you should see the staging site’s URL. Click the Open Staging Site button to open it.

The Open Staging Site button on the WP Staging plugin page.

Another way to access the staging site is to navigate to the WP StagingStaging Sites section from the WordPress dashboard. There, you’ll see the list of the existing staging sites.

The Your Staging Sites section on the WP Staging plugin page

Best WordPress Staging Plugins

Besides WP Staging, we recommend three more staging site plugins.

1. All-in-One WP Migration

The All-in-One WP Migration plugin logo

Plugin Stats:

  • Rating: 4.5/5
  • Best for: migrating websites
  • Price: free (extensions start at $69/year)

While All-in-One WP migration is not specifically designed for staging, its user-friendly migration tools are 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, making it easy to import and unpack at different locations. To do so, use its drag-and-drop feature in the destination website’s WordPress dashboard.

Some of its 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.
  • Automatic backups. Store a backup copy every time you export your site, which you can restore with a single click.
  • Multilingual. Choose from over 50 languages.
  • Inclusivity compliant. This plugin complies with the Web Content Accessibility Guidelines 2.1 AA Level, meaning it is accessible to 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 and file upload size limits.

All-in-One WP Migration is a free plugin. To get more advanced features such as multisite support, FTP support, and an upload size larger than 512 MB, you’ll need to buy separate premium extensions starting at $69/year.

2. Duplicator

The Duplicator plugin banner

Plugin Stats:

  • Rating: 5/5
  • Best for: migrating, copying, or cloning a site
  • Price: freemium (paid plans starting at $49.50/year)

Duplicator is also not a plugin specifically built for creating a WordPress staging website, but it can be very useful for this process.

This plugin clones, backs up, and migrates WordPress sites between hosts and domains, enabling users to easily duplicate the original site to a staging environment or the other way around. It also creates a package consisting of a ZIP file of the site’s database, content, plugins, themes, and other WordPress files.

Some of the best Duplicator 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.
  • Scheduled backups. The paid 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 file distribution.
  • Supports large sites. Migration in a package makes Duplicator capable of handling larger WordPress websites effectively.
  • Drag-and-drop installs. Restore or overwrite the live WordPress website 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.

The Duplicator plugin has five versions: the free version and four premium ones. While the Basic plan costs $49.50/year, the most expensive Elite version is priced at $299.50/year.

3. WP Stagecoach

The homepage of the WP Stagecoach plugin's website

Plugin Stats:

  • Best for: staging
  • Price: paid, starting at $99/year

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. As a result, it doesn’t overwrite the database during the importing process, improving your security.

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 that regularly update their content or database. This is because 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.
  • Password-protected staging site. Preview the staging site with a password-protected custom URL.
  • Selective migration. Select what changes you want to upload to the live site.
  • Supports large websites. The plugin also works well with multiple websites. It can import site files in chunks, which is helpful if the server is slow or has strict limits.
  • Recovery provision. WP Stagecoach provides a link to revert to the site’s previous version in case of an error.
  • Pre-migration changelog check. The plugin keeps track of any changes you’ve made on the staging site, so you can check the newest ones before importing them to the live site.
  • Progress messages. Instead of a spinning loading icon, you will see progress messages during the staging process.

WP Stagecoach is a paid plugin with various plan options starting at $99/year.

Conclusion

The WordPress staging environment enables you to modify your website with ease. Unlike production sites, staging websites won’t be indexed by search engines, and visitors won’t be able to access them. As a result, you won’t need to worry about breaking the main site while experimenting.

In this tutorial, we’ve covered three ways to create a WordPress staging site:

  • Using Hostinger’s WordPress staging feature – the quickest method.
  • Manually – a more advanced method, providing full control over the whole staging creation process.
  • With a plugin – a great choice if the current hosting provider doesn’t offer an integrated staging feature.

If you have any further questions or suggestions, leave them in the comment section below.

Author
The author

Nadia M.

Maya is a website development and digital marketing enthusiast, and 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.

Author
The Co-author

Ignas R.

Ignas takes great satisfaction in helping people tackle even the most complex technical issues. His current goal is to write easy-to-follow articles so that these issues will not happen at all. During his free time, Ignas likes to play video games and fix up things around his house.