WP multisite to use one media library for all sub-site

by Aftab   Last Updated August 16, 2018 15:08 PM

I am working on a Multisite project.

Overview: We are creating the content/posts on main site using Visual Composer page builder plugin and then cloning that post across all sub site using a cloner plugin.

Problem: Suppose that we have created a post with ID 10 and in Visual Composer I am using an image component and inserting two images ( attachment ) with ID 15 and 18 . If I cloned the post across all multisite, the posts are cloned correctly but the images are breaking because the image being cloned doesn't always have the same ID throughout the sub-site.

What I need: I need a solution where I need only one MEDIA LIBRARY (databse ) and all sites and subsites will use images from that media library.

What I have done till now I have tried many plugins but none of them meets my requirement. Some plugins are synchronising the image through all sub-site but not giving the same image id through all subsite.

Searching : Checking core code and finding hooks where we can change the table name when we are fetching the images and displaying in MEDIA library. There we can change the table to always use the main site posts table for fetching the attachment in Media Library.



Related Questions


Multisite: copy template when a subsite is created

Updated August 30, 2018 17:08 PM

Automatically clone wordpress multisite

Updated November 09, 2017 03:08 AM

WPMU wrong media URL with custom upload folder

Updated June 22, 2017 08:08 AM

Upload media Remote or Api

Updated April 10, 2016 08:03 AM