A staging site is a private copy of your website where you can test changes, updates, or new plugins before applying them to the live site. This prevents breaking changes from affecting your visitors.
Method 1 — Using a subdomain (recommended)
Step 1 — Create a subdomain
- Log in to cPanel.
- Go to Domains → Subdomains.
- Create a subdomain called staging (e.g. staging.yourdomain.com).
- Note the document root folder that cPanel assigns (e.g. public_html/staging).
Step 2 — Copy WordPress files
- In cPanel File Manager, select all files in public_html (your live site).
- Copy them to public_html/staging.
Step 3 — Copy the database
- In cPanel, go to Databases → phpMyAdmin.
- Select your live WordPress database.
- Click Export → Quick → Go to download a .sql file.
- Create a new database in cPanel under MySQL Databases.
- In phpMyAdmin, select the new database, click Import, and upload the .sql file.
Step 4 — Configure the staging wp-config.php
- In File Manager, open public_html/staging/wp-config.php.
- Update the database name, username, and password to match the new staging database.
- Save the file.
Step 5 — Update WordPress URLs in the staging database
- In phpMyAdmin, select the staging database and click the SQL tab.
- Run the following two queries (replace the URLs with your actual domains):
UPDATE wp_options SET option_value = 'https://staging.yourdomain.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://staging.yourdomain.com' WHERE option_name = 'home';
Step 6 — Password protect the staging site
Keep your staging site private so it does not appear in search engines and is not accessible to the public.
- In cPanel, go to Security → Directory Privacy.
- Navigate to the staging folder and enable password protection.
- Set a username and password.
Method 2 — Using the WP Staging plugin
The WP Staging plugin automates all of the above steps. Install it from the WordPress plugin repository, click Create Staging Site, and it will clone your site automatically.