Cloning Without Media Files

Leaving “Copy media files” checked is the default and safest operation. When checked, the Cloner will copy the entire uploads directory for the source site, and replace all media URL’s in the content to the new copied files.

If you have a lot of clones and are concerned about storage space for all the copied uploads files, or you have another reason that you don’t want media files to be copied (e.g. you have a huge media library that would take too long), you can uncheck the “Copy media files” setting. In this case, the files will not be cloned, and uploads URLs will not be replaced.

However, it’s important to be aware that cloning with that setting off may have side-effects, and you should be prepared to do some custom configuration and modifications if so. The main issue is that after cloning with the copy media option turned off, you may well notice missing images or other missing assets on the cloned site. This is because depending on your theme and plugins, some assets may have URL’s auto-generated using the wp_upload_dir() function rather than being hardcoded into the site content (thus the Cloner’s replacements settings will have not effect). In this case, the URL’s will point to the cloned  site’s uploads directory rather than the source site’s, and since the files weren’t copied, the assets will of course not be found.

In order to fix this, you can add a filter like the following on the cloned site. This code should be active only on the cloned site, and will change all subsite uploads URLs back to the main site (e.g will become To point one subsite to another subsite, you’d need to modify the replacement value.

add_filter(    'upload_dir',    function( $data ) {       foreach( $data as $key => $value ) {          $data[ $key ] = str_replace( '/sites/' . get_current_blog_id(), '', $data[ $key ] );       }       return $data;    },    999 );

However, be aware that this will also affect new uploads to the cloned site – they will be put in the main uploads directory, and in some environments this may cause additional issues.

The bottom line is, if possible it’s always better and more reliable to keep media cloning enabled. Disabling it is an advanced option, best only if you are experienced with advanced WordPress customizations and willing to do some custom setup and troubleshooting based on your specific site’s parameters.

Still need help? Contact Us Contact Us