An open API service indexing awesome lists of open source software.

https://github.com/bueltge/multisite-global-media

Share a media library across the WordPress Multisite network
https://github.com/bueltge/multisite-global-media

media multisite-network wordpress-plugin

Last synced: 8 months ago
JSON representation

Share a media library across the WordPress Multisite network

Awesome Lists containing this project

README

          

# Multisite Global Media

[![Build Status](https://img.shields.io/travis/com/bueltge/multisite-global-media.svg?style=flat-square)](https://travis-ci.org/bueltge/multisite-global-media)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bueltge/multisite-global-media/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bueltge/multisite-global-media/?branch=master)
[![Php Min Version](https://img.shields.io/packagist/php-v/bueltge/multisite-global-media.svg?style=flat-square)](https://packagist.org/packages/bueltge/multisite-global-media)
[![MIT License](https://img.shields.io/github/license/bueltge/multisite-global-media.svg?style=flat-square)](./LICENSE)

_Multisite Global Media_ is a WordPress plugin that shares media across the Multisite network.

## Description
This small plugin adds a new tab to the media library, which allows you to share media from one site to all the other sites of the network. By default, the Site ID is set to '1'. You can set/change this Site ID via the filter hook `global_media.site_id` which is run in a custom plugin like so

```php
add_filter( 'global_media.site_id', function() {
return 1234;
} );
```

To get Global Media to work, please follow these steps:

1. Decide which blog/site will host the shared media for the network.
2. Add media to the media library for the chosen blog/site.
3. Find the Site ID of your chosen site by going to your Network WP Admin. In the left-hand menu, choose "All Sites", and then click on "edit" under the site you need. In the address bar, you will see `site-info.php?id=4` where the last number is the ID.

![Finding the site ID](./assets/images/screenshot-site-id.png)

4. If the Site ID of your chosen site is '1', then you don't need to make any changes. If it's a different ID number, then please read the section below about modifying the Site ID via hook and a custom plugin.

Note: A useful enhancement in the Multisite context is the plugin [Multisite Enhancement](https://github.com/bueltge/wordpress-multisite-enhancements). It also helps to identify the site and get his site ID.

## Set your Site ID for the Global Mediathek
If you need to change the default Site ID '1' to another value, then you can do so by creating a small custom plugin.

1. In `/wp-content/mu-plugins/` create a new folder `mgm-set-my-site-id`.
2. `In /wp-content/mu-plugins/mgm-set-my-site-id/` create a new file `mgm-set-my-site-id.php`.
3. Add the following content to 'my-plugin.php'. Change the return value to your chosen Site ID.

```php