Sharing the wp-content folder over different Wordpress multisite installs

I have four different Wordpress multisite installs which I would like to keep separate for good reasons, but I would be happy if I could share at least some of wp-content. Is there a clean way to get this done?

I tried putting these in wp-config.php:

define('WP_CONTENT_DIR', '/home/shared_root/public_html/wp-content');
define('WP_CONTENT_URL','http://www.shared_domain.com/wp-content');

I quickly learned that sharing the uploads folder over various multisite installs will create quite a mess, so I added this:

define('UPLOADS', 'wp-content/uploads' );

Sharing plugins folders seems risky as well, however. One plugin update might change the database, and then I'll have a mess on all the other sites. I've also encountered problems with custom fonts not displaying properly (at least not in Firefox), as it seems they can't be loaded from a different domain:

https://stackoverflow.com/questions/11616306/css-font-face-absolute-url-from-external-domain-fonts-not-loading-in-firefox

So then I added this to wp-config.php as well:

define('WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins' );
define('WP_PLUGIN_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content/plugins' );

Which leaves me with only a shared themes folder. Unfortunately, defining the plugin directory above will break the convenient Wordpress update function (Wordpress will now think the plugins folder is external and ask for an FTP login when I hit "update"). And of course, due to the Firefox issue above, some of the themes in the shared folder will also appear broken.

Is there a better way to get this done (a "Multisite for Multisites") or should I just accept the fact that what I am trying to do creates more inconveniences than convenience? Thanks!

Topic plugins-url multisite Wordpress

Category Web


Since I was able to find a solution, I am answering the question myself.

Unlike what I have read elsewhere, it is indeed possible to place wp-content outside of the document root. Open basedir needs to be disabled, and the path to the new folder needs to have sufficient permissions.

Concerning the issue with custom fonts, I found the solution here:

http://davidwalsh.name/cdn-fonts https://serverfault.com/questions/162429/how-do-i-add-access-control-allow-origin-in-nginx

So yes, it is possible to use them from a different domain.

The only issue that possibly remains is plugins updating the database, but in the rare event that this happens, I am assuming it can be fixed by disabling/enabling the plugin on the respective sites.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.