Five steps for testing and deploying WordPress changes safely

How to Create a WordPress Staging Site and Test Changes Safely

Have you ever wanted to update a WordPress plugin, change your theme, or add custom code but worried that something might break on your live website?

It is a reasonable concern. A plugin update can affect an existing feature, a theme change can alter your page layouts, and even a small PHP customization can cause an unexpected error.

One of the safest ways to handle these changes is to use a WordPress staging site.

A staging site is a separate copy of your website where you can test updates, troubleshoot problems, make design changes, and review new functionality without directly affecting the website your visitors are using.

In this guide, we’ll explain what a staging site is, how to create one, how to protect it, and how to move approved changes to your live website without overwriting important data.

What Is a WordPress Staging Site?

A WordPress staging site is a private testing version of your existing website. It usually contains a copy of your WordPress files, database, themes, plugins, media uploads, and website settings.

It works separately from your live website, which is commonly called the production site.

For example, imagine your live website is:

https://example.com

Your staging environment might use an address such as:

https://staging.example.com

You can make changes on the staging version, test them, and review the results before applying approved changes to the live website.

This is especially useful when:

  • Updating WordPress core, themes, or plugins.
  • Testing a new theme or page-builder layout.
  • Adding custom PHP, CSS, or JavaScript.
  • Changing WooCommerce settings or checkout functionality.
  • Testing membership or LMS functionality.
  • Troubleshooting plugin and theme conflicts.
  • Changing PHP versions or server configurations.

Staging Site vs Live Website: What’s the Difference?

Although both environments may look almost identical, they serve different purposes.

  • Live website: The public website used by visitors, customers, and employees.
  • Staging website: A testing copy where developers can safely experiment with changes.
  • Local development website: A version running on a developer’s own computer, usually used for coding and development work.

The important distinction is that a staging site should not be treated as another live website. It should be protected and configured specifically for testing.

1. Create a Backup of Your Live WordPress Website

Before creating a staging environment or making major website changes, create a complete backup of your live website.

A full WordPress backup should include two important parts:

  • Website files: WordPress core files, themes, plugins, uploads, and configuration files.
  • Database: Posts, pages, users, settings, product information, orders, and other stored website data.

Backing up only the database is not enough to restore the entire website because your images, themes, plugins, and other files are stored separately.

How to back up WordPress using cPanel

  1. Log in to your hosting control panel.
  2. Open File Manager.
  3. Locate your WordPress installation directory.
  4. Select the WordPress files and folders.
  5. Compress them into a ZIP archive.
  6. Download the ZIP file to your computer or secure backup storage.
  7. Open phpMyAdmin from cPanel.
  8. Select the database used by your WordPress installation.
  9. Open the Export tab.
  10. Choose SQL format and export the database.

Keep the website files and database backup as separate files. Use clear filenames and record the backup date.

For example:

website-files-backup.zip
website-database-backup.sql

Before proceeding, make sure the database export completed successfully and that your files archive is available.

2. Check Whether Your Hosting Provider Offers Staging

The easiest way to create a staging site is to use a staging feature provided by your hosting company.

Many WordPress hosting providers offer tools that automatically clone your live website into a separate testing environment.

Depending on your hosting setup, you may find this feature under:

  • WordPress Manager
  • WordPress Toolkit
  • Softaculous Apps Installer
  • Staging or Clone
  • Website Management

The exact location and availability depend on your hosting provider and hosting plan. Not every cPanel account includes a staging feature.

Typical steps for creating a staging site

  1. Log in to your hosting control panel.
  2. Open the WordPress management tool if one is available.
  3. Select your existing WordPress installation.
  4. Look for a Staging, Clone, or Create Staging option.
  5. Choose a staging address or subdomain.
  6. Start the cloning process.
  7. Wait for the files and database to be copied.
  8. Open the staging URL and test the website.

For example, a staging tool might create:

https://staging.example.com

Once the process is complete, you should have a separate copy of your website to use for testing.

If your hosting provider offers a one-click staging feature, it is generally the simplest option because it handles much of the cloning and configuration for you.

3. What If Your Hosting Provider Does Not Offer Staging?

You can still create a staging environment if your hosting account does not include a one-click staging feature.

One option is to create a subdomain and clone your website manually or with a migration tool.

Create a staging subdomain

  1. Log in to cPanel.
  2. Open the Domains section.
  3. Create a subdomain such as staging.example.com, if your hosting setup supports it.
  4. Confirm its document root.
  5. Make sure the subdomain points to a separate directory rather than your live website’s document root.

Create a separate database

Your staging website should use its own database. Do not connect the staging installation directly to the live website’s database.

  1. Open MySQL Database Wizard or the database management section in cPanel.
  2. Create a new database for the staging installation.
  3. Create a dedicated database user.
  4. Assign the required privileges to that user.
  5. Keep the database name, username, and password available for the staging configuration.

Copy the website files and database

Next, copy the live WordPress files into the staging directory and export the live database using phpMyAdmin.

Import the database into the new staging database, then configure the staging WordPress installation to use the new database credentials.

There is one important detail: WordPress stores website URLs in several places, including serialized database data.

Do not use a simple SQL REPLACE() query across the entire database to change the live URL to the staging URL. This can damage serialized data and cause plugins or theme settings to stop working.

Use a migration tool that safely handles serialized data, or have your hosting provider or developer complete the URL replacement.

Recommendation: If you are not comfortable managing WordPress files, databases, and URL replacements, use a hosting-provided staging feature or ask a developer to create the staging copy. A partially configured clone can cause more problems than it solves.

4. Protect Your Staging Website

This is one of the most important steps, and it is often overlooked.

A staging website may contain a copy of your live website’s content, user accounts, customer information, API keys, and other configuration data.

It should not be left publicly accessible without appropriate protection.

Enable password protection

Use your hosting provider’s password-protection feature or another server-level access control method to restrict access to the staging website.

This prevents ordinary visitors and search engine crawlers from accessing the testing environment.

Discourage search engines from indexing staging

Inside the staging WordPress dashboard:

  1. Go to Settings > Reading.
  2. Find Search Engine Visibility.
  3. Enable Discourage search engines from indexing this site.
  4. Click Save Changes.

This setting adds a request for search engines not to index the staging site.

Important: This setting does not restrict visitor access and is not a security feature. Password protection should be your primary protection. The search visibility setting is an additional precaution, not a replacement for access control.

Identify the environment in WordPress

WordPress supports an environment type setting that allows themes and plugins to identify whether the website is running locally, in development, on staging, or in production.

If your hosting provider has not already configured the staging environment type, you can set it in the staging site’s wp-config.php file.

Add this code before the line that says That's all, stop editing!:

if ( ! defined( 'WP_ENVIRONMENT_TYPE' ) ) {
    define( 'WP_ENVIRONMENT_TYPE', 'staging' );
}

This identifies the installation as a staging environment for compatible WordPress code and plugins.

Do not copy this staging configuration back to your live website. Also, remember that setting the environment type does not password-protect the site.

5. Prevent Staging From Sending Real Emails or Payments

Cloning a website can also copy settings that allow it to interact with real customers and external services.

For example, a staging copy of an online store may still contain:

  • Email notification settings.
  • Payment gateway configuration.
  • Subscription integrations.
  • Third-party API credentials.
  • Scheduled tasks and automated workflows.
  • Newsletter and CRM integrations.

If these settings are left unchanged, your testing environment could accidentally send real emails, trigger external services, or interact with live payment systems.

Use a separate testing configuration

Before testing, review the following:

  • Use a mail-catching service or staging-specific email configuration instead of sending messages to real customers.
  • Switch payment gateways to sandbox or test mode.
  • Use test API credentials where supported.
  • Review scheduled tasks and external integrations.
  • Disable or safely redirect automated workflows that could affect production systems.

Be particularly careful with subscriptions, membership renewals, booking systems, and automated billing.

For WooCommerce stores, use test payment credentials and verify that test orders do not trigger real customer communications or fulfilment workflows.

6. Test Your WordPress Changes on Staging

Once your staging website is ready and protected, you can start testing.

The goal is to reproduce the changes you intend to make on your live website and confirm that everything works as expected.

Test plugin and theme updates

Update the plugins and themes on staging first. Then check the important areas of your website.

  • Homepage and internal pages.
  • Navigation menus and headers.
  • Forms and contact pages.
  • Login and registration.
  • Mobile and tablet layouts.
  • Page-builder templates.
  • Custom post types and archive pages.

Do not only check whether the homepage loads. A plugin update may affect a specific template, form, or feature that is used on only a few pages.

Test custom code

If you are adding PHP, CSS, or JavaScript, test the changes on staging before moving them to production.

For example, if you have added a custom WooCommerce price display function, check:

  • Simple product prices.
  • Variable product prices.
  • Shop and category archives.
  • Single product pages.
  • Cart totals.
  • Checkout calculations.

This helps confirm that a display change has not accidentally altered the actual purchase price.

Test forms and website functionality

Submit test forms, check login functionality, review email handling, and test any feature that depends on an external service.

If your website uses WooCommerce, membership software, or an LMS, test the complete customer journey rather than only the visual design.

7. Move Approved Changes to Your Live Website

After testing, you can move the approved changes from staging to production.

However, this step requires care. Moving an entire staging database to a live website can overwrite information that was added to production after the staging copy was created.

This is particularly important for websites that receive new orders, comments, registrations, form submissions, bookings, or membership activity.

Deploy files when you only changed code or design

If you changed a child theme, stylesheet, JavaScript file, or custom plugin, it may be safer to deploy only the files that were changed instead of replacing the entire website.

Keep a copy of the current production files and make sure you know exactly which files need to be updated.

Be careful when synchronizing databases

If your staging site contains a database copied from an earlier version of the live website, it may not include newer production data.

For example, a WooCommerce store may have received new orders after the staging copy was created. Replacing the live database with the older staging database could remove those orders and other recent changes.

For this reason:

  • Take a fresh backup of production before deployment.
  • Prefer deploying only the files that have changed when possible.
  • Move specific content separately when appropriate.
  • Do not replace the entire live database without understanding exactly what will be overwritten.
  • For stores and membership websites, plan database changes around live customer activity.

If your hosting provider offers a selective deployment feature, review the files and database options carefully before synchronizing.

8. Check the Live Website After Deployment

Once the changes have been applied, open the live website and verify that everything is working.

Do not assume that a successful deployment means the website is functioning correctly.

Use this final checklist:

  • Homepage loads correctly.
  • Important internal pages open successfully.
  • Navigation menus work.
  • Forms can be submitted.
  • Login and registration work.
  • Mobile layouts display correctly.
  • WooCommerce products, cart, and checkout work where applicable.
  • Important integrations are functioning.
  • No unexpected PHP errors appear in the logs.
  • Page caching and CDN caching are behaving correctly.

Also confirm that the live website is not accidentally configured to discourage search engines from indexing it. That setting should remain enabled on staging, not production.

Common Staging Site Mistakes to Avoid

Even though staging is designed to make website changes safer, incorrect configuration can still create problems.

Watch out for these common mistakes:

  • Skipping backups: A staging site does not replace a separate, restorable production backup.
  • Leaving staging publicly accessible: Protect it with server-level access controls.
  • Allowing real emails: Testing can accidentally send notifications to actual customers.
  • Using live payment credentials: Always use test credentials when testing transactions.
  • Replacing the production database blindly: This can remove orders, users, and other recent data.
  • Forgetting search visibility settings: Make sure production is not left with the staging site’s noindex setting.
  • Testing only the homepage: Important problems may appear on forms, checkout, archives, or other specific templates.

Final Thoughts

A WordPress staging site is one of the most useful tools for making website changes safely.

Whether you are updating plugins, modifying a theme, adding custom code, or testing WooCommerce functionality, having a separate testing environment can help you identify problems before visitors experience them.

Start by creating a complete backup, use your hosting provider’s staging feature if available, protect the testing environment, and verify every important feature before deploying changes.

Most importantly, be careful when moving database changes back to production. A staging website may contain older customer, order, and user data, so deploying the entire database without checking it can cause data loss.

A little preparation and testing can save significant time, prevent unexpected downtime, and make WordPress maintenance much more predictable.

Helpful Resources

About Zahid Iqbal

Zahid Iqbal is a founder and ceo of MZ Creative Studio. He is a web developer and designer with over 3 years of experience. His mission is to provide best web services and useful tools to everyone round the globe.

Leave a Reply

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

Do you have a website project you’d like to discuss?

Get in touch