How to Create a Staging Site & Clone WordPress

We have a quick start guide for creating a WordPress clone if you want to get started faster.

Congratulations, you’ve decided to create a genuinely independent WordPress staging and development website with WP STAGING.

That is the first step to ensure that no site changes will ever break your production website.

Before creating a testing website, decide whether you want to make your staging site accessible from a subdirectory of your production site, a subdomain, or a completely different domain.

Possible Domain Options

Staging site in a subfolder “staging”:
https://example.com/staging

Staging site in a subdomain:
https://staging.example.com

Staging site in another domain:
https://newsite.com

All three variants are possible with WP STAGING | PRO!

Create a Staging Site in a Subfolder

That is the easiest and fastest way to create a testing WordPress website, and it is the default option supported even by the WP Staging basic version.

Note: The user interface may look slightly different depending on your WP Staging version.

Go to WP Staging > Staging Sites and click CREATE NEW STAGING SITE.

Create Staging Site Button

Add the name of the staging site and ignore Advanced Settings:

Start Cloning Button

That makes the staging site available from a URL like https://example.com/development.

Exclude Plugins and Tables

Under DB Tables and Files, you can include and exclude individual database tables and folders from the cloning process.

For example, it is useful if you have large tables created by web statistic plugins, security plugins, or mailing plugins that contain thousands or even millions of rows of data like IP addresses, login attempts, and mailing list subscribers. Excluding those tables will increase the cloning speed tremendously.

If unsure, leave the default values and the DB Tables and Files selection untouched.

Create a Staging Site From a WordPress Multisite

Multisites are only supported by WP STAGING | PRO.

When cloning a multisite, you have multiple options:

  • Option 1: Go to the primary site and clone the entire multisite, including all network sites, by activating the checkbox “Clone entire multisite.”
  • Option 2: Go to the main site or one of the network sites and unselect the checkbox “Clone entire multisite.” Then, WP Staging will clone only the current main or network site and no network network sites. Doing that will convert the network site into a single site. This usually works very well, but not all multisite plugins may be compatible with that approach. In that case, option one is recommended.

WP STAGING supports the following domain-based structure for multisites:

  • example.com
  • subsite1.com
  • subsite2.com
  • subsite3.com

E.g., When cloning into the subdirectory “staging,” the URLs become:

  • example.com/staging
  • subsite1.com/staging
  • subsite2.com/staging
  • subsite3.com/staging

You can also clone into a subdomain, and the results will be:

  • staging.example.com
  • staging.subsite1.com
  • staging.subsite2.com
  • stagingsubsite3.com

If you want to give each network site a completely different location, you can use this filter.

You can optional use WP Staging backup & migration feature to backup a network site and clone it to another (sub)domain. To do so, create a new multisite from scratch on a subdomain of your choice and then use the WP Staging Backup & Migration feature to download the whole multisite backup and then upload and restore the backup on the new multisite.

Advanced Settings (WP Staging Pro Only)

This optional section allows you to choose several things like:

  • Custom destination directory
  • Custom destination hostname in a subdomain like dev.example.com
  • Clone into another external database

Clone to Another Database

Use these options to connect the site to another external database you created beforehand. Then you can clone the production website to that new database instead of using the main default WordPress production site database.

Staging Site - Advanced Settings

Change the Destination of the Staging Site

You can also change the destination to which the staging site is copied.
This option lets you select a custom destination folder instead of using the default subfolder in the production website’s root directory.

This can be useful if you copy the site to a subdomain instead of a subdirectory.

If you are a little lost about what option you should use or are pleased with the default destination, you can skip this step. Just leave the default values as they are and click on START CLONING.
In that case, WP STAGING will create a staging site in a subfolder of your production site.

For example, if your production website is located in /public_html and you label the staging site development then, you must copy the testing website to /public_html/development to make it available.

If you want to specify the Target Directory of your staging site, adjust the Target Hostname:

For instance, if your production site is located in /public_html and you’ve set the
Target Directory to /public_html/wordpress/development, you need to use the
Target Hostname https://domain.com/wordpress/development

No Permissions to Write to Root Folder (ABSPATH)

If your website is hosted on flywheel, wordpress.com, or another host that has the WP core files outside the root folder, you can change the destination directory to the folder ./wp-content/

This folder is always writeable!

For example, your staging site is named “staging”:

Clone to a Subdomain, Another Domain, or Host

You can clone the production website to a subdomain or different domain as long as the path to that new (sub)domain is located on the same server, and the live site can access this folder.

Instead of following the steps below, you can use the backup feature of WP STAGING. Watch this video or read this article.
  • Create a (sub)domain, like dev.example.com from within your hosting panel (cPanel or similar).
  • ​Create a new folder on your server and map the new (sub)domain to this directory. That folder must be writable by the PHP and webserver process. (www-data or similar with permissions 755)
  • Open WP STAGING | PRO and click on Create New Staging site.
  • Open WP STAGING advanced settings and add the new target hostname and the directory.
Copy Staging Site into Subdomain

Bonus: If you are not sure if the subdomain points to the correct path, you can use that little trick:

  • Create a text file and name it test.txt.
  • Add some content into that file, such as “test text.” Use a file manager plugin or FTP to do so.
  • Copy that file into the path you think is correct.
  • Open the file from URL example.com/test.txt. If the path is correct, You can see the text “test text” in your browser.

Cloning to a Separate Database

If you do not tell WP STAGING to use a separate database for the cloning process, all database tables will be copied to the main database and prefixed with a string such as wpstg [id] _.
This prefix separates the tables that belong to the production site from those that belong to the staging site.

That prefix ensures the staging website is entirely independent of the production website. So the WordPress default database object wpdb has no access to the staging website, and the staging website has no access to the production site.

If you still want a little more safety and separation between both sites, you can copy the database tables to another database.

To do so, activate the checkbox Copy Staging Site to Separate Database and enter the input fields’ database credentials. Make sure that you have created that other database in advance. WP STAGING cannot do that for you due to database permission restrictions.

You can usually create a new database from your hosting dashboard (cPanel) from the database section.

When you are done, test the connection by using the Test Database Connection link:

Clone to a separate database

Start Cloning Process

Click on START CLONING and watch WP STAGING creating the clone of your WordPress website automatically:

The cloning process

Depending on the size of your website, this can take a few minutes or a little longer. When you do that, you’ll get the screen below:

The clone is ready

From that page, you can directly open the staging site by clicking on the Open button, and you will also get an explanation that tells you that permalinks on the staging site are disabled for technical reasons.

Tip: If you use the Apache web server, try activating the permalinks again on the staging site. That should work well.

If you like to open your staging site the next time, go to
WP Staging > Staging Sites.

List of staging sites

You’ll get all the previously created staging sites there.

BTW. You can create as many sites as your web space allows.

More useful links:

Updated on August 17, 2024