How to set up a WordPress staging site (and why you need one)
11 min read · 22-Jan-2026
villagehosting.in team
22 January 2026
Pushing an untested plugin update to your live site is like changing your car engine on the motorway. A staging site takes 15 minutes to set up and saves days of panic.
Keep staging in sync with production data
A staging site with 2-month-old data can miss problems caused by recent content changes. Before testing a major update, sync fresh production data to staging first. Many staging plugins (WP Staging, All-in-One WP Migration) can do this in one click. Testing against stale data gives false confidence.
What is a staging site?
A staging site is a private copy of your website where you test changes before applying them to the live version. It is usually on a subdomain like staging.yourdomain.com or dev.yourdomain.com and is either password-protected or not indexed by search engines.
Why you need one
Plugin updates break sites
WordPress plugins update frequently. A poorly-tested update can break your checkout, crash your homepage, or conflict with your theme. Testing on staging first lets you catch this without your customers seeing it.
Theme changes are risky
A miscalculation in a CSS edit, a template file with a PHP error — things that are easy to introduce and immediately visible to visitors. Staging lets you develop and test before going live.
Major WordPress core updates
WordPress major version updates (4.x → 5.x → 6.x) occasionally break plugins or themes. Testing on staging before updating production gives you time to fix compatibility before it becomes a problem.
Client work and agency projects
If you build or manage sites for others, a staging environment is professional standard. Clients review changes on staging before they go live. No surprises.
Method 1: WP Staging plugin (easiest)
WP Staging is a free plugin that creates a staging copy in a subdirectory of your site.
Setup:
- Install "WP Staging" from WordPress plugin directory
- WP Staging → Start Staging Site
- Name your staging site (it becomes
yoursite.com/staging-name) - Select which database tables to include (default: all)
- Select which files to include (default: all)
- Click "Start Cloning"
How it works: WP Staging copies your database and files into a separate subdirectory. The staging site has its own wp-config.php pointing to a separate database prefix, so changes on staging do not affect your live database.
Limitations:
- Staging is in a subdirectory, not a subdomain (staging.yourdomain.com vs yourdomain.com/staging)
- Free version does not push changes back to production (paid version does)
- Not suitable for testing domain-dependent features (canonical URLs, etc.)
Best for: Quick plugin testing, theme development, content changes.
Method 2: cPanel subdomain clone (most reliable)
This creates a proper staging environment on a subdomain with its own database.
Step 1: Create a subdomain
- cPanel → Subdomains
- Create:
stagingunder your domain - Document root:
/public_html/staging(cPanel fills this in automatically)
Step 2: Clone your database
- cPanel → MySQL Databases → Create a new database (e.g.,
youruser_staging) - Create a new database user and grant full privileges to the staging database
- cPanel → phpMyAdmin → select your live database → Export → Quick → SQL → Go
- phpMyAdmin → select your staging database → Import → choose the .sql file → Go
Step 3: Copy your files
- cPanel → File Manager → public_html → Select all → Copy
- Paste into
/public_html/staging
Or via SSH (faster for large sites):
cp -r ~/public_html ~/public_html/staging
Step 4: Update wp-config.php in staging
Edit public_html/staging/wp-config.php:
define('DB_NAME', 'youruser_staging');
define('DB_USER', 'youruser_staginguser');
define('DB_PASSWORD', 'your-new-password');
Step 5: Update database URLs
The staging database still has your live domain in it. Update it:
Using WP-CLI:
wp search-replace 'https://yourdomain.com' 'https://staging.yourdomain.com' --path=/public_html/staging
Or use the free "Better Search Replace" plugin:
- Install Better Search Replace on staging
- Search for:
yourdomain.com - Replace with:
staging.yourdomain.com - Run on all tables
Step 6: Password-protect staging (important)
You do not want search engines to index your staging site or customers to stumble onto it.
- cPanel → Directory Privacy → public_html/staging
- Enable password protection
- Create a username and password
You can also add this to .htaccess in the staging directory to block search engine crawlers:
<IfModule mod_headers.c>
Header set X-Robots-Tag "noindex, nofollow"
</IfModule>
Or add define('DISALLOW_SEARCH_INDEX', true) to the staging wp-config.php (this only works for WordPress's own sitemap).
Method 3: Managed host staging tool
If your host provides a staging tool (VillageHosting and other managed WordPress hosts typically do), this is the easiest option:
- Portal → Services → your WordPress site → Staging
- Click "Create staging site"
- The host clones your database and files automatically
- Visit
staging.yourdomain.comto test
When you are ready to go live, click "Push to production" — the host applies your tested changes to the live site.
This is the recommended approach if it is available on your plan.
Keeping staging in sync
A staging site becomes stale as the live site gets new content. Before major testing, refresh your staging database from production:
- Export the live database
- Import to the staging database (replacing the old one)
- Run the search-replace to update URLs back to staging
Do this whenever the staging database is more than a week old.
What to test before pushing to production
- All pages load without PHP errors or warnings
- Forms submit correctly (contact form, checkout, booking)
- User login and account functionality
- WooCommerce checkout end-to-end (test purchases)
- Any custom post types or taxonomies
- Search functionality
- Mobile layout on actual devices (not just browser responsive mode)
- Any recently updated plugins individually (enable the update, test, then the next one)
Common mistakes with staging
Not running search-replace on URLs: Images and links break because they still point to the live domain.
Forgetting to password-protect: Google indexes your staging site, causing duplicate content issues.
Using staging for too long: A staging environment that diverges too far from production becomes hard to sync. Use it for specific changes, then push.
Pushing database from staging to production: Unless you specifically need staging content on production (unlikely), only push files, not the database. Pushing the staging database overwrites all production content.
Staging for WooCommerce
WooCommerce staging needs extra care because of:
- Orders and inventory are in the database — test mode must be active
- Payment gateways must be set to test/sandbox mode in staging
- Shipping rules may behave differently on staging URLs
Always enable WooCommerce sandbox/test mode before testing anything payment-related on staging. In WooCommerce → Settings → Payments, enable test mode for each payment gateway.
A properly set-up staging environment is one of the highest-leverage investments you can make in your site's reliability. 15 minutes of setup prevents hours of emergency fixes.