Skip to content
GPLWP Guides

How to clone WordPress sites

Backup & Migration Time About 30–90 minutes 7 steps Updated 13 Oct 2026

BACKUP & MIGRATION
The short answer

To clone a WordPress site, copy its files and database to a new location, update the database connection, and safely replace the old URLs. The manual route is fine for an occasional clone, but a plugin is quicker when you repeat the job or manage several sites.

The route
  1. 01Prepare the source and target
  2. 02Back up the complete site
  3. 03Copy the files and database
  4. 04Replace the old URLs safely
  5. 05Fix the target configuration
  6. 06Test the cloned site
  7. 07Use MainWP Clone for repeat copies

What you need

  • Administrator or hosting control-panel access to the source and target sites
  • A full backup of the source files and database
  • A separate target domain, subdomain, or hosting account
  • SFTP or file-manager access and a way to import a MySQL database

Prepare the source and target

Decide whether the clone will use a new domain, subdomain, server, or local development URL. Put the target into maintenance mode if visitors or customers could reach it while you work. For WooCommerce, pause order processing or clone from a staging copy so new orders are not missed.

Record the source URL, database name, database user, table prefix, PHP version, and any special server settings. A clone is a full copy, not a WordPress export: the database and the wp-content files both matter.

Back up the complete site

Back up the entire WordPress directory, including wp-content/uploads, themes, plugins, and any custom files, then export the complete WordPress database. WordPress documents both the files and database as necessary parts of a move.

Keep the backup outside the hosting account and do not delete the source until the clone has been checked. If the source is busy, take the database export and file copy as close together as possible to reduce the chance of mismatched content.

Copy the files and database

Create the target database and database user, then grant that user access. Upload the copied WordPress files to the target document root and import the database through the host’s database tool or command line.

Do not assume the table prefix is wp_; retain the prefix used in the exported database. If the target server uses different database credentials, edit the copied wp-config.php so its database name, user, password, host, and table prefix match the target.

Replace the old URLs safely

When the target uses a different domain or path, replace the old site URL throughout the database. Use a serialization-aware method rather than a basic SQL REPLACE(): WordPress settings, widgets, theme options, and page-builder data can contain PHP-serialized values whose stored lengths must be updated.

With WP-CLI, run a dry run first, then use wp search-replace 'https://old.example' 'https://new.example' --skip-columns=guid from the target site directory. WP-CLI handles serialized data and provides a dry-run option; multisite installations need the appropriate network option.

Fix the target configuration

Check that the target’s home and siteurl values point to the new address. WordPress identifies these values as part of the move, and they can be updated in the database or with WP-CLI if the dashboard is inaccessible.

Log in, visit Settings → Permalinks, and save the settings once to refresh rewrite rules. Clear WordPress, plugin, server, and CDN caches. If the site shows blank pages, redirect loops, missing images, or a three-slash URL such as https:///, check the URL replacement and database connection before changing files at random.

Test the cloned site

Check the homepage, several posts and pages, media files, forms, user login, search, menus, scheduled tasks, and any integration that sends email or uses an API. For WooCommerce, inspect products, checkout, payment settings, webhooks, and order emails before making the copy public.

Confirm that the clone cannot accidentally send production emails, process real payments, or connect to production services. Keep the source backup until the target has passed these checks. For a one-off clone, this manual route is usually sufficient; the main drawbacks are the file transfer, database import, URL replacement, and troubleshooting all being your responsibility.

Use MainWP Clone for repeat copies

For the fast route, use MainWP Clone when you manage several WordPress sites or regularly replicate a working setup. It is designed to clone a full site, including themes, plugins, settings, content, and media, from a MainWP-managed workflow, with backup and activity-log features for the process.

Install and activate it on the relevant WordPress sites, connect the source and target through MainWP, and follow its clone workflow. Still verify the target URL, database access, cache, email, payments, and external integrations after the copy. A cloning plugin removes much of the repetitive work, but it does not remove the need to check a live clone before handing it over.

The fast route

Let MainWP Clone do it

One-click full-site cloning with MainWP management, ideal for agencies replicating setups across multiple WordPress sites.

Get MainWP Clone

Sources

  1. developer.wordpress.org /advanced-administration/upgrade/migrating/?utm_source=opena…
  2. developer.wordpress.org /cli/commands/search-replace/?utm_source=openai
  3. wordpress.org /support/topic/weirdness-with-empty-site-url-when-cloning/?u…
  4. developer.wordpress.org /advanced-administration/wordpress/wp-config/?utm_source=ope…

Questions

Can I clone WordPress without a plugin?
Yes, you can clone WordPress without a plugin by copying the files, exporting and importing the database, updating the target configuration, and safely replacing URLs. The manual route is reasonable for an occasional copy when you have hosting or command-line access. It becomes slower and more error-prone when you repeat it across many sites or need a consistent agency workflow. <cite></cite>
What must be copied when cloning a WordPress site?
You must copy both the WordPress files and the database. The files contain WordPress core, themes, plugins, uploads, and custom code, while the database contains posts, users, settings, menus, and much of the site configuration. Copying only <code>wp-content</code> or using the WordPress XML export will not produce a complete working clone. <cite></cite>
Why does a cloned site show the old domain?
A cloned site shows the old domain when old URLs remain in the database, configuration, cached files, or page-builder data. Check the <code>home</code> and <code>siteurl</code> values, then run a serialization-aware search and replace across the database. Do not use a simple SQL text replacement on serialized values, because it can invalidate stored string lengths and break settings. <cite></cite>
Should I change the site URL before or after cloning?
Change the site URL after importing the database into the target, unless you have a specific staging workflow that requires otherwise. This lets you replace the source address with the exact target address while the copied database is in place. Run a dry run first, exclude the <code>guid</code> column unless you have a reason to alter it, and clear caches after the replacement. <cite></cite>
What commonly breaks after a WordPress clone?
The most common failures are incorrect database credentials, unchanged <code>home</code> or <code>siteurl</code> values, broken serialized settings, stale rewrite rules, missing uploads, and production integrations still connected to the clone. Check the database connection, save Permalinks again, clear caches, inspect media and forms, and disable live payments or outgoing email before testing the copy publicly. <cite>