Network Media Library is a plugin for WordPress Multisite which provides a central media library that's shared across all sites on the Multisite network.
I made this because it seems the original repo is no longer maintained as far as I can tell. I basically just implemented a few bugfixes that were not getting merged into the main repository. Feel free to use this fork in your projects.
This small plugin transparently shares media from one central media library site to all the other sites on the network. All media that's uploaded gets transparently directed to the central media site, and subsequently made available network-wide. Nothing is copied, cloned, synchronised, or mirrored, so for each file that's uploaded there's only one attachment and one copy of the file.
PHP: 7.0
WordPress: 4.9
As a composer package:
Add this to your project's composer.json under repositories:
{
"type": "package",
"package": {
"name": "broskees/network-media-library",
"version": "master",
"type": "wordpress-muplugin",
"source": {
"url": "https://github.com/broskees/network-media-library.git",
"type": "git",
"reference": "master"
}
}
}
composer require broskees/network-media-library dev-master
If you don't use Composer, install the plugin as you would normally.
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.
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;
} );
Use the media library on the sites on your network just as you would normally. All media will be transparently stored on and served from the chosen central media library site.
Attachments can be deleted only from within the admin area of the central media library.
Network Media Library works transparently and seamlessly with all built-in WordPress media functionality, including uploading files, cropping images, inserting media into posts, and viewing attachments. Its functionality works with the site icon, site logo, background and header images, featured images, galleries, the audio and image widgets, and regular media management.
The plugin works with the block editor, the classic editor, the REST API, XML-RPC, and all standard Ajax endpoints for media management.
Links to media from other sites mostly work, although there are a couple of edge case bugs in WordPress core that need to be fixed (I'll get to these soon).
Compatibility with third-party plugins is good, but not guaranteed. The following plugins and libraries are explicitly supported by Network Media Library:
The following plugins and libraries have been tested and confirmed as compatible out of the box:
I plan to fully test (and add support if necessary) many other plugins and libraries, including CMB2, Fieldmanager, and many gallery and media management plugins. Stay tuned for updates!
There are no screenshots to show as Network Media Library operates transparently and introduces no new UI. Simply upload, manage, insert, and use your media as you would normally, and everything will operate through the central media library.
Good news, this plugin is free for everyone! Since it's released under the MIT, you can use it free of charge on your personal or commercial site.
This plugin originally started life as a fork of the Multisite Global Media plugin by Frank Bültge and Dominik Schilling at Inpsyde, but has since diverged entirely and retains little of the original functionality.
The initial fork of this plugin was made as part of a client project at Human Made. We build and manage high-performance WordPress websites for some of the largest publishers in the world.
Hurrah for open source!
If the Network Media Library plugin doesn't suit your needs, try these alternatives: