If you’re a WordPress Developer or Full Stack Developer, working with multisite networks is a common task—especially when scaling projects. One of the most practical requirements is cloning a subsite quickly and efficiently.
Whether you’re a WordPress Custom Plugin expert, WooCommerce Developer, or even a MERN Stack Developer expanding into WordPress ecosystems, this guide will help you understand both plugin-based and programmatic approaches.
In this tutorial, we’ll walk through how to clone a specific subsite in a WordPress Multisite network using two methods:
- Using a plugin (easy & fast)
- Programmatically (advanced & flexible)
Let’s get started.
Method 1: Clone a Subsite Using a Plugin
For most Plugin Developers and beginners, this is the fastest way to duplicate a subsite with minimal effort.
Cloning subsites can be done in just one click from the WordPress dashboard.
Step 1.1 Configure Duplication Settings
First, install and network-activate a WordPress Custom Plugin like Duplicate Site for WordPress Multisite.
Navigate to:
Network Admin → Settings → Duplicate Site
Here, you can configure:
- Post types to duplicate
- Post statuses
- Whether to copy media files
- Assign users to the new subsite
For example:
- If you don’t want media duplication, uncheck:
“Duplicate files from uploads directory” - Exclude unnecessary post types like:
attachment- custom types like
event
This step is important for optimizing performance and avoiding unnecessary data duplication.
Settings > Duplicate Site
Step 1.2 Select Database Tables
Each subsite may have different database tables depending on installed plugins.
As a WooCommerce Developer or Full Stack Developer, you’ll often deal with custom tables.
You can:
- Select specific tables to clone
- Exclude heavy tables (like Action Scheduler)
This ensures faster and cleaner duplication.
Step 1.3 One-Click Clone
Now go to:
Sites → All Sites
You’ll see a Clone option next to each subsite.
With one click, your subsite is duplicated instantly.
This method is ideal for:
- Agencies
- Rapid deployments
- Non-technical users
How to clone a subsite with the Duplicate Site for WordPress Multisite plugin.
Method 2: Clone a Subsite Programmatically (Without Plugin)
For advanced users like a Plugin Developer or MERN Stack Developer, this approach provides full control.
However, it requires careful handling of database and file structures.
Step 2.1 Create a New Subsite
Start by creating a fresh subsite using:
$original_blog_id = 1;
$original_blog = get_site( $original_blog_id );
$new_blog_id = wpmu_create_blog(
$original_blog->domain,
$original_blog->path . '-copy',
get_blog_option( $original_blog_id, 'blogname' ) . ' Copy',
get_current_user_id(),
array(
'public' => $original_blog->public,
'archived' => $original_blog->archived,
'mature' => $original_blog->mature,
'spam' => $original_blog->spam,
'deleted' => $original_blog->deleted,
),
get_current_network_id()
);
👉 Note:
- Works best for subdirectory setups
- Requires adjustments for subdomain configurations
Step 2.2 Duplicate Database Tables
Instead of looping through content using switch_to_blog(), directly copy database tables.
global $wpdb;
$table_names = array( 'wp_posts', 'wp_postmeta' );
foreach( $table_names as $table_name ) {
$new_table_name = str_replace( "wp_", "wp_{$new_blog_id}_", $table_name );
$wpdb->query("CREATE TABLE IF NOT EXISTS `$new_table_name` LIKE `$table_name`");
$wpdb->query("INSERT `$new_table_name` SELECT * FROM `$table_name`");
}
Important Considerations:
- Exclude options like:
siteurl,home,admin_email
- Skip unnecessary post types (e.g., revisions)
- Remove meta keys:
_edit_lock,_edit_last
This is where an experienced WordPress Developer or Full Stack Developer can optimize performance significantly.
Step 2.3 Add Users to the New Subsite
Users are shared across multisite, but permissions must be reassigned.
$user_query = new WP_User_Query( array(
'blog_id' => $original_blog_id,
'number' => -1,
) );
foreach( $user_query->get_results() as $user ) {
add_user_to_blog( $new_blog_id, $user->ID, $user->roles[0] );
}
👉 Note:
- Multiple roles require manual handling
- Important for membership or WooCommerce stores
Step 2.4 Copy Media Files
To fully clone a subsite, copy uploads recursively:
function rudr_recurse_copy( $from, $to ) {
$from = untrailingslashit( $from );
$to = untrailingslashit( $to );
$dir = opendir( $from );
@mkdir( $to );
while( false !== ( $file = readdir( $dir ) ) ) {
if( $file == '.' || $file == '..' ) continue;
if( is_dir( "{$from}/{$file}" ) ) {
rudr_recurse_copy( "{$from}/{$file}", "{$to}/{$file}" );
} else {
copy( "{$from}/{$file}", "{$to}/{$file}" );
}
}
closedir( $dir );
}
Usage:
$upload_dir = wp_upload_dir();
switch_to_blog( $new_blog_id );
$new_upload_dir = wp_upload_dir();
rudr_recurse_copy( $upload_dir['basedir'], $new_upload_dir['basedir'] );
Which Method Should You Choose?
- Plugin Method
Best for speed and simplicity
Ideal for non-technical users - Programmatic Method
Best for customization and scalability
Preferred by experienced Plugin Developers, WooCommerce Developers, and Full Stack Developers
Final Thoughts
Cloning a subsite in WordPress Multisite isn’t difficult—but doing it correctly requires attention to detail.
If you’re a WordPress Developer, mastering both approaches gives you flexibility:
- Use plugins for quick tasks
- Use code for scalable, custom solutions
For agencies and businesses, combining WordPress Custom Plugin development with MERN Stack Developer expertise can unlock powerful automation and performance improvements.
If you have any questions or want a custom solution tailored to your multisite setup, feel free to ask.
Read More:
A Strategic Way to Build a WordPress Website for Growth
Please leave a comment below if you have any questions.
Hi and welcome! I’ve spent more than 7 years helping WordPress users with easy-to-follow guides, tutorials, and practical tips all completely free.Need expert developer help? I’m just a message away.