Playing Nicely With the Wordpress Source in Subversion

I’ve used Wordpress on a bunch of projects and have never figured out a satisfactory way to manage my own code (i.e. plugins and themes) in a Subversion repository alongside Wordpress — until now.

Here are a few things I’ve tried in the past:

  • Checkout the latest stable version of Wordpress from the WP SVN repository. Then create a separate repository of my own for themes and plugins. Then check out each individual subfolder from my repository in the appropriate subfolder on WP. Nightmare upgrading.
  • Export the WP SVN repository into my own repository, so everything is in one place. When WP needs to be upgraded, manually merge the new version in. Upgrading WP versions becomes a real drag, though the advantage of this approach is that you can alter WP source code if you need to (not that you should, but sometimes there’s no way around it).

Well, not that this is all that exciting, but I recently came up with what I consider to be a superior way of organizing things:

  1. Check out the latest tag from the WP SVN repository into whatever location I’m going to be hosting WP from.
  2. Create a separate repository for my files, with the main subfolders being themes/ and plugins/. Check these out into a separate location outside of the web root.
  3. Create a symbolic link under WP source subfolders to the appropriate subfolder in my repository. For example, if I had my own custom theme in a versioned project checked out at /var/private/my_project/themes/my_theme and my Wordpress source checked out at /var/www/wordpress, I would just do $ ln -s /var/private/my_project/themes/my_theme /var/www/wordpress/wp-content/themes/my_theme. Easy.
  4. I can now upgrade my WP installation via a simple svn switch command, and update my own custom files just as easily. Instant party.

I frankly think this solution rocks. The only slight disadvantages are a.) you do have to manually create the symbolic link for each subfolder you add (e.g. every time you add a new plugin), and b.) you can’t really make changes to WP source code or your update won’t work (this isn’t entirely true, you just have to manage your WP upgrades a little more carefully).

Post a comment

Contact Info
will not be published

include http://

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>