How to Clone a Site Within Your Multisite Network

Contents

Introduction

Cloning a site within a WordPress Multisite Network can save hours of configuration and content setup. Whether youre running a network of client sites, staging environments, or simply want to spin up a development sandbox, having a reliable cloning strategy is essential. In this comprehensive guide, you will learn three primary methods to clone a subsite: using a dedicated plugin, leveraging WP-CLI, and performing a manual clone.

Prerequisites

  • Network Administrator Access: You must be logged into your Network Admin dashboard.
  • Database Credentials: Ensure you have credentials for your MySQL/MariaDB server.
  • File System Access: SFTP/SSH or cPanel File Manager access to the /wp-content/ directory.
  • Backup: Always take a full backup using UpdraftPlus or a similar tool.

Method 1: Using a Plugin

For most non-technical users, a plugin offers the simplest path. Two popular options:

Plugin Key Features Cost
NS Cloner One-click clone, handles files DB, deep clone rules Free core premium add-ons
Multisite Clone Duplicator Wizard-driven clone, pro templates, custom find/replace Premium plugin

Step-by-Step with NS Cloner

  1. Install and network-activate the NS Cloner plugin.
  2. In Network Admin, navigate to NS Cloner gt Add New Clone.
  3. Select your Source Site and define a Destination Site Name and URL.
  4. Adjust advanced options (user roles, content filters) if needed.
  5. Click Clone and wait. The plugin copies database tables, uploads, themes, and plugins automatically.

Method 2: Using WP-CLI

For developers comfortable with command-line tools, WP-CLI is powerful and scriptable. Ensure you have SSH access and WP-CLI installed. Follow official docs.

Commands Overview

  1. Create a new subsite:
    wp site create --slug=newsite --title=New Site --email=admin@example.com
  2. Export source site database tables:
    wp db export source.sql --url=oldsite.network.local
  3. Import into destination site:
    wp db import source.sql --url=newsite.network.local
  4. Perform search/replace on URLs and paths:
    wp search-replace oldsite.network.local newsite.network.local --url=newsite.network.local
  5. Copy uploads folder:
    cp -r wp-content/uploads/sites/2/ wp-content/uploads/sites/5/

Method 3: Manual Approach

This approach is educational but error-prone. Use it only if you need full control.

  1. In phpMyAdmin or via CLI, export all tables for your source site (e.g., wp_2_posts, wp_2_options, etc.).
  2. Duplicate those tables with new prefixes (e.g., wp_5_) using SQL CREATE TABLE new LIKE old INSERT INTO new SELECT FROM old.
  3. Open wp_site and wp_blogs tables, add a new row for your cloned site. Mirror the domain, path, site_id, and blog_id.
  4. Update wp_5_options to set siteurl and home to your new path.
  5. Copy files from wp-content/uploads/sites/2/ to wp-content/uploads/sites/5/.

Post-Cloning Steps

  • Log into the cloned site admin and verify site settings: Permalinks, Reading, Discussion.
  • Check file amp folder permissions (uploads directory should be 755 or 775).
  • Flush caches (object cache, CDN, plugin caches).
  • Update SSL certificates if using custom domains.
  • Run a security scan: WP Scanner, Wordfence.

Common Issues Troubleshooting

  • 504 Gateway Timeout: Increase PHP MySQL timeouts or clone in smaller batches.
  • Incorrect URLs: Rerun WP-CLI search-replace or use Search Replace DB.
  • Permalink 404 Errors: Save Permalinks again in Settings.
  • Missing Media Files: Confirm uploads folder structure matches new site ID.

Security Considerations

  • Never expose wp-config.php or wp-content/uploads to public write access.
  • Rotate API keys and salts if you cloned sensitive environments.
  • Review user roles and capabilities—remove unwanted administrative accounts.
  • Ensure SSL/TLS is enforced for both front-end and backend.

Conclusion

Cloning a site in a WordPress Multisite Network can be straightforward with the right approach. For ease of use, plugin solutions like NS Cloner are unbeatable. Developers and power users will appreciate the flexibility of WP-CLI. Manual cloning offers ultimate control but carries more risk. Choose the method that best fits your technical comfort level and project requirements.

By following these detailed instructions, you’ll have a reliable process to spin up new subsites in minutes—perfect for testing, staging, or client rollouts.



Acepto donaciones de BAT's mediante el navegador Brave 🙂



Leave a Reply

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