Support for WordPress Multisite Shared Media

Support for WordPress Multisite Shared Media

4.15 (13 ratings) 4.15 stars
Cart 824 sales

aikadesign does not currently provide support for this item.

Popular questions for this item

Quick Start Guide

IMPORTANT! Before you install the plugin, take a full backup of your files and database.

We will provide assistance in getting the plugin to work, but it’s your responsibility to make sure you can recover in case things go bad.

Please note: When you activate the sharing, the media URLs on the sub-sites (that is, other than main site) will be pointed to the main sites’ uploads directory, thus their existing image files must be moved to that same directory. This is included in the below listed steps.

  1. Install the plugin following the steps f. ex. here
  2. Copy the existing images from wp-content/uploads/sites/X directories to wp-content/uploads
    On command line, you can mimic the following (do it for each sub site, replace the-sub-site-id):
    you: ~$ cd /path-to/your-site/wp-content/uploads/
    you: /path-to/your-site/wp-content/uploads$  cp sites/[the-sub-site-id]/* . -R
  3. On dashboard, go to My Sites > Network Admin > Settings > Multisite Shared Media
  4. Choose the sharing settings:
    • Share media across network – The general on/off switch: when you upload a media file, it will become available on the other network sites too
    • Remove media from all sites upon media removal – when you remove a media file from any of the sites, it will disappear from all other sites too
    • After you enable sharing by clicking Save settings, additional tabs will appear: Site Relationships and Media Replication.
  5. Choose which sites should share media:
    • Open Tab: Site Relationships
    • Use the checkboxes on the network site matrix to select which sites should share media with each others.
    • The sharing is activated both ways.
    • Only items originally uploaded to given site will be shared to the sites which are linked with that site.
    • For example: If sites A and C are linked to site B, but not to each other, then an image uploaded to site A would be shared to site B, but not C. However an image uploaded to site B would appear on both sites A and C.
  6. Replicate existing media:
    • Open Tab: Media Replication
    • The replication tool allows you to choose the source and target sites, and will replicate all existing media which is originally uploaded to the source site to the target site.
    • The process may take some time if there are hundreds or thousands of images, but you can break/pause the process, or even just close the browser if you need to.
    • The tool will continue its operation from the next unsynced item the next time you start the process.
    • Since version 1.1.0 you can repeat the replication process as many times as you want – without duplicates. This is a killer feature when adding new sites to the network. :grin:
  7. Finally, when you have checked the images work on all sites, you can save some disk space by removing the existing images from the sub-sites (if there are any):
    On command line you can mimic the following (do it for each sub-site separately):
    you: ~$ cd /path-to/your-site/wp-content/uploads
    you: /path-to/your-site/wp-content/uploads$ rm sites/[the-sub-site-id] -rf
  8. After you have the setup you need, you are ready to go. The plugin will now listen to any file uploads, and keep the media libraries in sync silently on the background.

PS. There is a Demo Video which guides you through all these steps except plugin installation, see it on the item page clicking on the Video Preview!

How does it work?

When you upload an image to one of your site while having the sharing enabled, the plugin replicates the image to all other sites without copying the file itself, thus you save disk space and hosting costs by not having multiple copies of the same file.

See also Filters and Actions we are using

I have different domains, will my media be served from the right domain?

Yes. Each site will have the media file available on its own domain.

How about compatibility with other plugins?

In short, incompatibilities occur most often with: a) post/content duplicators b) visual page builder tools

For those cases, we’ve developed a “compatibility framework” for the plugin, in which we can hook in adjustments to make it work nicely together with the major plugins, when problems arise.

For example, we’ve especially made the plugin compatible with WooCommerce Multistore, which is a great plugin for operating multiple WooCommerce stores with shared properties.

In all cases, you should test the file upload and removal processes carefully before production deployment, and make sure to have a full file and database backup before installing & activating the plugin.

We are willing to hear about any compatibility issues you may face. :grin:

See also » Filters and Actions we are using

Can I safely uninstall this plugin once I start using it?

The short answer is yes.

However, after uninstall, you will need to include this small piece of code in your theme’s functions.php to make sure the URL’s to the images stay functional:

 * Force all network uploads to be stores in wp-content/uploads, and ignore
 * URL rewrite of files for blog-specific directories.
 * @param   array   $dirs
 * @return  array
function msm_keep_global_upload_dir( $dirs ) {
    $dirs['baseurl'] = get_site_url() . '/wp-content/uploads';
    $dirs['basedir'] = ABSPATH . 'wp-content/uploads';
    $dirs['path'] = $dirs['basedir'] . $dirs['subdir'];
    $dirs['url'] = $dirs['baseurl'] . $dirs['subdir'];

    return $dirs;
add_filter('upload_dir', 'msm_keep_global_upload_dir');

The reason for this is that the plugin, while active, needs to alter the image paths in order to obtain disk space savings. :grin:

How about media deletion?

You have a separate switch to enable/disable ‘shared removal’. If it’s enabled, the media is removed from all sites. If not, it gets removed from only the site it was removed on, and leaving the other sites untouched.

What WordPress hooks is this plugin using?

(Updated for version 0.6)

Our plugin hooks to following WP filters and actions. You may want to review your current plugins to see if they are using the same ones:

  • filter: wp_die_ajax_handler
  • action: added_post_meta
  • action: add_attachment
  • filter: upload_dir
  • filter: wp_update_attachment_metadata
  • action: delete_attachment
  • filter: wp_delete_file
  • action: admin_enqueue_scripts
  • action: network_admin_menu

Show more