0

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!

  • Have you seen WP Multi Network? – fuxia Jan 16 '15 at 23:20
  • Looks interesting, but it doesn't seem to be what I need. My multisite installations are very different in scope and userbase. My main goal is to share identical files on the server for added convenience. Sharing userbase or other things is what I explicitly don't want. – Brokenstuff Jan 16 '15 at 23:32
1

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.

  • Interesting. Just one thought: I'd not classify "plugins updating the database" as a "rare event". This happens all the time. – kraftner Nov 13 '15 at 10:53
  • "plugins updating the database structure"? – Brokenstuff Nov 14 '15 at 10:27
  • Well pretty common too. Not in terms of changing core tables, but adding new ones and sometimes changing them on upgrades. – kraftner Nov 16 '15 at 9:45
  • Yeah, I've given up on this anyway. Too many complications. Table structure isn't the only issue (although it is one), there's also the odd plugin that simply won't work in this setup. Might be sloppy programming or some other reason, but regardless, this has happened 2-3 times and was a huge time killer every time, so I've switched back to separate plugin folders for each install. – Brokenstuff Nov 16 '15 at 13:07

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.