Network Media Library for WordPress Multisite

repository·master·Indexed 43 days ago

https://github.com/humanmade/network-media-library

A WordPress Multisite plugin that creates a single, shared media library across an entire network to prevent duplication. It ensures all uploaded media is stored centrally on a designated site ID and remains available network-wide. Supports the Block Editor, Classic Editor, REST API, and plugins such as Advanced Custom Fields and MultilingualPress. Requires PHP 7.0 and WordPress 4.9.

Tokens
512
Snippets
2
Records
4
Agent score
5%

What's inside Network Media Library

  1. How Network Media Library works

    master

    Network Media Library provides a central media library shared across all sites in a WordPress Multisite network.

    Key Concepts:

    • Transparent Sharing: All media uploaded from any site in the network is automatically directed to the central media site.
    • No Duplication: Files are not copied, cloned, synchronized, or mirrored. For every uploaded file, there is exactly one attachment and one physical file stored on the central site.
    • Usage: Users interact with the media library on any site in the network exactly as they would normally.
    • Deletion: To prevent broken links across the network, attachments can only be deleted from within the admin area of the central media library site.
  2. Install Network Media Library

    master

    Network Media Library can be installed via Composer or manually. Because it is a network-wide plugin, it must be installed as a Must-Use (mu-plugin) or network-activated. It cannot be activated on individual sites within the multisite network.

    Minimum Requirements:

    • PHP: 7.0
    • WordPress: 4.9
    composer require humanmade/network-media-library
  3. Configure the central media library site ID

    master

    By default, the plugin uses Site ID 2 as the central media library. If your central media site has a different ID, you must configure it using the network-media-library/site_id filter hook.

    add_filter( 'network-media-library/site_id', function( $site_id ) {
        return 123;
    } );
  4. Compatibility and Supported Plugins

    master

    The plugin works transparently with built-in WordPress media functionality (uploading, cropping, inserting, viewing) and supports the Block Editor, Classic Editor, REST API, XML-RPC, and standard Ajax endpoints. It also works with site icons, logos, featured images, and galleries.

    Explicitly Supported Plugins:

    • Advanced Custom Fields
    • MultilingualPress
    • Regenerate Thumbnails
    • WP User Avatars

    Tested and Confirmed Compatible:

    • BuddyPress
    • Extended CPTs
    • Gutenberg
    • Stream
    • User Profile Picture