WordPress Staging Site on Shared Hosting: Safe Setup

Short answer: you can run a WordPress staging site on shared hosting without special tools. First check your hosting panel for a built-in staging feature. If there is none, build the copy yourself: create a subdomain with its own folder, create a new, empty database, copy your site's files and import a database export into it, point the copy's wp-config.php at the new database, change its URLs with a serialization-safe tool, then hide it from search engines and password-protect it.

Written against WordPress 7.1.2. Last verified: September 27, 2026. Hosting control panels change their menus often, so the panel steps below describe the job, not exact button names.

Read this first: the one mistake that turns staging into damage

A staging copy exists so you can break things safely. Set it up wrong and it does the opposite.

The dangerous version: you copy your site's files into a new folder and leave wp-config.php unchanged. That file still holds the live site's database name, user and password. Your "staging" site now reads and writes your live database. Every test post, deleted page or plugin setting you change on staging happens on the real site.

So, before you start:

  1. Take a full backup of the live site, files and database, and confirm you could restore it. Our guide on how to verify a WordPress backup covers the check.
  2. Plan to create a separate database for staging. Never point staging at the live one.
  3. Do every search-and-replace step on the staging database only.

Option 1: check whether your host already has staging

Some hosting panels, including some on ordinary shared plans, include a staging or "clone" feature, sometimes inside the WordPress installer tool in the panel. Look for words like Staging, Clone or Create copy next to your WordPress installation.

If it exists, it usually performs the same steps described below for you. Two things to confirm before trusting it:

  • Does it create a separate database? It should. If the tool's help page does not say so, ask your host's support.
  • How does it push changes back? Some tools overwrite the whole live site, database included, when you push. That can erase comments, orders or posts added to the live site since you made the copy. Find out what "push to live" does before you ever click it.

If your panel has no staging feature, or you want to understand exactly what is happening, build it by hand.

Option 2: build the staging copy by hand

This works on typical shared hosting that gives you a file manager (or FTP), a database tool such as phpMyAdmin, and the ability to create subdomains. It does not require SSH, although SSH makes step 6 easier.

Step 1: create a subdomain with its own folder

In your hosting panel, create a subdomain such as staging.yourdomain.com. The panel will ask for a folder (sometimes called the document root) for it.

  • Give it its own folder, for example staging next to your live site's folder.
  • If the panel offers to share the main domain's folder, decline. A shared folder means staging and live are the same files.

Step 2: create a new, empty database

Use your panel's database tool to create a new database and a database user, and give that user full rights on the new database. Write down three values: the database name, the user name and the password. You will need them in step 5.

Step 3: copy the files

Copy everything in your live WordPress folder into the new staging folder: wp-admin, wp-includes, wp-content and the files in the root, including wp-config.php and hidden files such as .htaccess. In many file managers you must turn on "show hidden files" to see .htaccess.

The simplest way on shared hosting is usually to compress the live folder into a zip in the file manager, copy or move the zip into the staging folder, and extract it there. Delete the zip afterward so it is not left downloadable.

Step 4: export the live database and import it into the new one

In phpMyAdmin, select the live database, open Export, use the quick method, and download the .sql file. Then select the new staging database, open Import, and upload that file.

Double-check which database is selected before you import. Importing into the live database would overwrite it.

Step 5: edit the staging copy's wp-config.php

Open wp-config.php in the staging folder (not the live one) and change:

define( 'WP_HOME', 'https://staging.yourdomain.com' );
define( 'WP_SITEURL', 'https://staging.yourdomain.com' );
  • Add one more line to label this copy as staging:
define( 'WP_ENVIRONMENT_TYPE', 'staging' );

The WordPress developer reference for wp_get_environment_type() (read September 27, 2026) lists the allowed values as local, development, staging and production, and says a site defaults to production when nothing is set. Setting it to staging tells WordPress, and any plugin that checks, that this is not the real site.

Save the file, then load https://staging.yourdomain.com/wp-admin/ and log in with your usual live username and password (the user accounts were copied with the database).

Step 6: replace the live URLs inside the staging database

The two lines above change where WordPress thinks it lives, but your posts, menus and settings still contain links to the live address. Click one and you can end up on the live site, logged in and editing it without noticing.

The same handbook page warns that a plain search and replace on the whole database "can cause issues with data serialization," because some themes and widgets store values with the length of the text recorded alongside it. Change a URL's length without updating that record and the setting breaks.

If you have SSH, WP-CLI's search-replace command is one of the tools the handbook lists. Its documentation says it "intelligently handles PHP serialized data," and it offers a --dry-run option that shows what would change without saving anything. Its own example skips the guid column, which the handbook says you should never change. Run it from the staging folder, dry run first:

wp search-replace 'https://yourdomain.com' 'https://staging.yourdomain.com' --skip-columns=guid --dry-run

Read the report, then run it again without --dry-run. Running it from the live folder would rewrite your live site's links, so check your current folder before pressing Enter.

Without SSH, ask your host whether they can run it for you. The handbook also lists search-replace plugins as an alternative; if you go that way, install it on the staging site only.

Step 7: hide staging from search engines and the public

Two layers, because one is not enough:

  1. Discourage search engines. In the staging site's admin, go to Settings > Reading and tick Discourage search engines from indexing this site. The WordPress.org documentation for the Settings Reading screen (last updated June 8, 2024, read September 27, 2026) says this adds a noindex,nofollow robots tag, and also notes that it does not block access: "it is up to search engines to honor your request."
  2. Password-protect the folder. Most hosting panels have a directory privacy or password-protection feature. Apply it to the staging folder so only people with the password can load the copy at all.

Only ever tick that search engine box on staging. On a live site it asks search engines to drop you.

Step 8: check that you are really on staging

Before testing anything, confirm the copy is independent:

  • The browser address bar shows the staging subdomain, and clicking a few internal links keeps you there.
  • Create a test draft on staging, then check the live site's Posts screen. The draft must not appear there. If it does, staging is using the live database: stop and fix wp-config.php.
  • Images load. If they are missing, the URL replacement in step 6 probably did not run.
  • The search engine visibility box is ticked on staging, and not on live.

Things staging still does that you might not expect

A staging copy is a working WordPress site, which means:

  • It can send email. Contact forms, password resets and plugin notifications may go to real people. Be careful testing anything that emails customers.
  • Scheduled tasks can run. WordPress's built-in scheduler is triggered by visits, so plugins that send newsletters, sync data or call outside services may act from the copy too.
  • It drifts from live. From the moment you copy it, new posts and comments keep arriving on the live site and not on staging. A staging copy is for testing changes, and copying staging back over live is a separate decision with its own risks.

For the most common use, trying an update before it touches the real site, our guide on how to test a WordPress update on a copy first picks up from here. And before any change on the live site itself, the five-minute ritual before a risky WordPress edit still applies.

FAQ

Can I create a WordPress staging site on shared hosting without a plugin?

Yes. The manual method above uses only your hosting panel's file manager, its database tool and a text edit to wp-config.php. SSH access makes the URL replacement step easier but is not the only way.

Should staging use a subdomain or a subfolder?

Either can work. A subdomain with its own folder keeps staging clearly separated from the live site's files and settings, which reduces the chance of editing the wrong copy.

Will the staging site hurt my search rankings?

It can compete with your live site if search engines index it. Tick Discourage search engines on staging and password-protect the folder so crawlers cannot reach the pages at all.

Do I need a separate database for staging?

Yes. If staging uses the live database, every change you test on staging happens on your live site. Create a new database and update DB_NAME, DB_USER and DB_PASSWORD in the staging copy's wp-config.php.

How do I know WordPress treats the copy as staging?

Set WP_ENVIRONMENT_TYPE to staging in the staging wp-config.php. The WordPress developer reference says sites without this setting default to production.

Wpnotar Editorial
Wpnotar Editorial
Articles: 73

Leave a Reply

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