How to setup shared media for WordPress multisite?

By default each site in WordPress multisite has its own media. However, if you want all sites to share same Media then that can be achieved using “Network Media Library” plugin. If you are short on time, please check video at the end of this article.

Total Time: 10 minutes

Download the plugin

Download the latest release of “Network Media Library” plugin from the GitHub repository – https://github.com/humanmade/network-media-library

Upload plugin to network

Navigate to your network admin dashboard and click on “Plugins” menu. Click on “Add New” and then “Upload Plugin” button. Click on “Choose file” button and then choose the zip file which you recently downloaded from above GitHub repository.

Network activate plugin

Once the plugin is installed, you need to “Network Activate” it. The plugin should either be installed as a mu-plugin or network activated. It’s a network plugin and therefore cannot be activated on individual sites on the network.

Setting shared media library

Site ID 2 is used by default as the central media library. You should configure your media library site ID via the filter hook network-media-library/site_id:

add_filter( 'network-media-library/site_id', function( $site_id ) {
return 123;
} );

That’s it once it is network activated you are all set to use shared media across your network site.

Video – shared media for WordPress Multisite

11 Comments

Hey there,
Just trying out this plugin and i was wondering how i would go about installing this when i already have a working site with all the images on an individual site level.
When i install it i get an empty media library. Do i have to re-upload all the images? Will the links still work? Any idea’s?

You need to add a line of code in the child theme’s functions.php.
add_filter( ‘network-media-library/site_id’, function( $site_id ) {
return 1;
} );

Hi there,

is it possible to create a site for all media (e.g. media.example.com) and “connect” to this site from 5-10 other “single” sites (like anotherexample.com, 3rdexample.net, and so on) ?

Hello !

Ça fonctionne très bien pour moi.
En revanche : pas de compatibilité avec “ACF options page” et les champs type “repeater”.
Avez-vous une idée ?
Merci de votre aide.

======

It works very well for me.
On the other hand: no compatibility with “ACF options page” and “repeater” type fields.
Do you have an idea ?
Thank you for your help.

======

Leave a Reply

%d bloggers like this: