How To Share Media Across WordPress Multisite

How To Share Media Across WordPress Multisite

WordPress multisite installs might use a single codebase but when it comes to media each site operates in its own silo.

If you are using multisite to publish multiple sites then reusing media across your sites either means inserting with a url or loading the image up twice. Hardly satisfactory.

In this Weekend WordPress project, we’ll take a look at how to share images, video and audio across your site, saving you considerable time, trouble and disk space.

Featured image
Sharing media across your multisite has enormous time saving benefits

The Network Shared Media plugin by Joost de Keijzer does exactly what it says on the tin: allows media to be shared across a WordPress multisite network.

Why is this important? In a default multisite install each site has its own media library, with no built-in capabilities to easily access media from other sites. The choices are either use the Insert from URL facility or load up the image into each site.

If you have a widely used set of images, such as logos or icons or portraits, then you have to either link to the original source (and trust that the URL doesn’t change) or load each item up in the site where you want to use it.

Clearly, the better option is to be able to select media from any site on the multisite network for insertion into a post and to not have to duplicate it. And preferably, have the URL look and feel as if it is local to the post’s site.

This is exactly what Network Shared Media provides.

Installing and network activating the plugin (there’s no need to activate on the individual sites) adds a new option, Network Shared Media to the Add Media dialog:

Screengrab of the Add Media dialog showing hte Network Shared Media link and the individual blog links
A new Network Shared Media option give you access to any network site’s media

Clicking on this new option, displays the media as normal but creates a new menu bar with links to each site on the network. Clicking on a site brings up the media for that site.

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

Selecting and inserting a media item is exactly as before (clicking on the Insert into Post button) but what’s interesting is that the plugin localizes the URLs, so although there is only one source, the URL is for the current blog, not the original.

For example, here’s the img tag and a tag for an image inserted into a post on Blog A but that physically actually resides in the primary site’s uploads folder (http://www.multisite.dev/wp-content/uploads).


<a href="http://www.multisite.dev/bloga/wp-content/uploads/2014/09/iphone3.png">
<img class="alignnone size-medium wp-image-nsm-1-11"
src="http://www.multisite.dev/bloga/wp-content/uploads/2014/09/iphone3-155x300.png"
alt="" width="155" height="300" />
</a>

No Featured Image Support

The only real drawback with the plugin is that it’s functionality doesn’t extend to the Featured Image selection tool.

This is not really the plugin’s fault as, and I hadn’t ever noticed this before, the Featured Image dialog is not the same as the Add Media button. It only allows for picking directly from the site’s media library or uploading a new item and doesn’t support Add Media functionality such as Insert from URL.

One For The Multisite Publisher’s Essential Plugin List?

If you use WordPress in multisite mode to manage several websites, then this plugin offers a time-saving way of sharing common media across those sites.

For that reason alone, it’s a prime contender for the Essential Plugin list for WordPress multisite operators.

Tags: