As WordPress users advance from beginners to professionals, their sites evolve into critical business assets. Editing live sites directly risks downtime, errors, and lost revenue. Many of our clients have requested a reliable tutorial on creating a staging environment. In this guide, drawn from years of managing production WordPress sites, we'll walk you through setting up a test environment to safely develop and test changes.
Note: Ideal for developers transitioning from basic to advanced workflows, this tutorial curbs 'cowboy coding' and instills best practices. By the end, you'll master:
For local development, we always recommend installing WordPress on your Windows or Mac machine. Once perfected locally, migrate to production. But what if local tweaks break on the live server? Issues like plugin conflicts or theme glitches can tank SEO, sales, and user trust.
The solution: A staging site—a cloned, restricted version (often a subdomain) on your production server. Test thoroughly here before promoting to live. For beginners avoiding complexity, opt for managed hosts like WP Engine (built-in staging) or SiteGround's affordable GrowBig plan.
Start by creating a subdomain for isolation—it runs independently without touching your main database, files, or uploads.
Log into cPanel (similar in other panels; search Domains or Subdomains). Under Domains, click Subdomains.

Enter a name like staging or dev, select your domain, and let cPanel auto-fill the Document Root (e.g., public_html/staging). Click Create.



Verify by visiting the subdomain—it should display a default page.

Create a dedicated FTP account for staging security.

In FTP Accounts, fill details matching your subdomain's directory. Click Create FTP Account.

Clone your live database and files for realistic testing.
Via cPanel's phpMyAdmin, select your live database, go to Operations.

Under Copy database to, name your staging DB (create first if needed, e.g., example_staging). Copy structure and data, then Go.

Select the new DB, click SQL, and run these queries to update URLs:
UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL'); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL'); UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL'); UPDATE wp_posts SET post_content = REPLACE(post_content, 'ORIGINAL_URL', 'NEW_URL');
Replace ORIGINAL_URL (e.g., https://example.com from Settings > General) and NEW_URL (e.g., https://staging.example.com). Adjust wp_ prefix if custom.
Download fresh WordPress from WordPress.org, upload to staging (don't install yet). Copy /wp-content/uploads, /themes, /plugins:
Open File Manager, navigate to public_html/wp-content.


Right-click each folder > Copy to /public_html/staging/wp-content/.


Note: If File Manager unavailable, FTP or SSH.
Visit staging; update wp-config.php with staging DB details. Log in with live credentials—changes are now isolated.
Post-login essentials:
Verify Domain: Check admin URL matches subdomain. Fix wp_options table if needed (siteurl/home).
Check Media: Media library should show uploads.
Disable XML Sitemaps: In Yoast SEO, turn off to avoid indexing.

Restrict Access: Install 'Restrict Site Access' plugin; configure under Settings > Reading. Also, uncheck search engine visibility. Add .htaccess password protection for /wp-admin/ or root.
Flush Permalinks: Settings > Permalinks > Save to fix 404s.
Pros use Git (via GitHub/Bitbucket) for history, rollbacks, and collaboration.
GitHub suits open-source (free public repos; paid private). Bitbucket offers free private repos—perfect for client/personal sites.
1. Install Git: Download for Windows/Mac.
2. Create Repo: Sign up at Bitbucket, Create repository (private, Git).


Choose 'I have an existing project'.
3. Init Local Repo: Git Bash: cd to project (e.g., /C/xampp/htdocs/wordpress/wp-content/themes/myawesometheme)
git init git add . git commit -m "Initial project commit"
4. Link & Push:
git remote add origin https://admin@989214.com/bitbucketusername/repositoryname.git git push -u origin --all
For changes:
git add . git commit -m "Added new features" git push -u origin --all
Use Ftploy (free tier): Sign up, add server with staging FTP details.


Test connection, save. New Project > Bitbucket > Select server/path (e.g., /wp-content/themes/your-theme).


Pushes auto-deploy.
Ftploy shines for staging; for live, manual copy after staging tests to avoid errors. See our WordPress errors guide for troubleshooting.
We hope this empowers safer WordPress development. Questions? Comment below.