Why WordPress can’t be shared

Aim

I have about 6 different WordPress installs on my host. One for me, one for my company TSD and 3-4 for friends and family on sub domains. The issues I have with it are:

  • Upgrading is a pain
  • Sharing plugin-ins is a pain
  • Gets worse for every new blog I install

So I tried to modify the WP code so that it could be installed (and upgraded) in one place and then used for many blogs on the same server. I found out that as it stands WP‘s design doesn’t scale very well. I guess it wasn’t meant to, but when you work with it you get the feeling it could…

Method

So I gave it a go and was half successful. Here what I did:

  1. In the index.php file I changed the PHP include path to point to the shared WP code base like so:
    $new_include_path = Array('/home/myaccount/public_html/wordpress', ini_get('include_path'));
    
    ini_set('include_path', implode(':', $new_include_path));
    
  2. I then had to go though a few 3-4 files and remove the use of the constant ‘ABSPATH’ as it wasn’t needed. Changing the include path really has its advantages here as PHP for the included file in the first directory of the and failing that the second and so on where as using constants in the code only gives you one shot at finding the file then you get the big nasty: ERROR!

Results

This was all that was really required and the front end worked. There was a skinning problem but this is probably just a case of removing the ABSPATH again. If only WP did all of its including in one place!

Anyway, the reason I said that I was only half successful is because the backend is designed differently from the front. Where in the front end all requests are handled via the one index.php file in the admin each page is a separate file. At this point I gave up as each file that is called directly would have to be modified and uploaded to each install and you start to lose the benefit of a central shared WP install.

Conclusion

The front and backend are really doing the same thing on WP so they should concentrate on making them use the same template engine system for displaying. This would allow themes to be applied to the back as comprehensively as the front and also allow this type of modification.

It would also be nice to have a shared plug-ins folder as well as a site specific one mixed. This would require the WP code base to embrace the include path modification (which some servers don’t allow but they would if they could deploy one copy to many accounts/customers).

If anyone has a better approach I would be glad to hear it.

Similar Posts: