6

I have a WordPress Multisite where the main site has all the images in the media library I want to use in each additional site, however I can't figure out a way to get all the images to show up in the additional sites' media library.

I've looked at the Network Shared Media plugin but it doesn't allow me to add the images where I need them. Only in post/page content.

  • This isn't easy because media libraries don't show files, they show posts of type attachment. The fundamental problem here is that you need an asset manager/catalog, there may be external services better suited – Tom J Nowell Aug 23 '17 at 22:17
1

@Casey did you find a solution yet?

I developed and maintain a plugin that should address your case quite well if I understand it correct.

It replicates the uploaded media library entry to all the sites using built-in WP functions, making them native media objects on each site. However, only a single copy of the actual file is stored on the disk to save disk space.

It is also possible to replicate all existing images throughout the network. Admin can choose if the media should also be deleted across the network, or per-site.

It can be bought from CodeCanyon: https://codecanyon.net/item/wordpress-multisite-shared-media/19306250?ref=aikadesign

P.S. I am affiliated with the product, which means that I get paid if someone purchases it. I understood it is okay to promote own product if it answers the question and if the affiliation is clearly communicated. I think the conditions apply here.

0

It appears there's a plugin for this: https://wordpress.org/plugins/network-shared-media/

  • Sorry, I forgot to add that I tried the plugin, but it didn't quite do what I want – Casey Aug 23 '17 at 21:50
  • link only answers become useless if the link breaks, you can link to something but you have to explain how the linked thing answers the question. In this case, an explanation of how that plugin achieves what it does – Tom J Nowell Aug 23 '17 at 22:18
0

As mentioned in a comment, media is actually a special 'post', so the media only belongs to the sub-site, and is not easily accessible from the subsite.

But there are methods to go though all subsites and display the media from all subsites on a single page in any subsite. I do this with my Multisite Media Display plugin (https://wordpress.org/plugins/multisite-media-display/ ), which first enumerates all subsites into an array, and then queries each subsite to display the images within that subsite. It does the work via a shortcode you display on a post/page. I use it to monitor the media on all subsites to ensure that the media meets the site's standards. And, if logged in as the super-admin, each image links to it's 'edit' page, which allows me to rotate pictures as needed.

As with all plugins, the code is 'open source' (and the plugin is free/full-featured), so if you wanted to 'roll your own', you could use the code processes that I use (which I gathered from the googles, and then tweaked the code into my plugin). I couldn't find a plugin that did what I needed, so wrote it for my own use. (And then I made variations to display posts or comments from all subsites via a shortcode.)

The plugin has options to specify subsites and other parameters, so you can 'filter' the output to what you need.

You are welcome to use the code in the plugin to make your own plugin that will do exactly what you need.

0

I came across the exact same issue. Try this... Add the following to your .htaccess file in your site's C-PANEL File Manager where your multi-site is installed, replacing other WordPress rules with:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

You can get this code straight from the Network Setup settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.