I download and configure Wordpress for a development environment and a production environment. After it's set up on one server we check it into a subversion repo and then go and check it out on the production server. Deployment complete.

The trouble is when I have to update. I'm supposed to delete wp-includes and wp-admin but if I do that svn goes crazy.

What are some strategies for dealing with Wordpress, subversion, and multiple deployment environments?

2 Answers 2


Externals, definitely. Set up your own SVN repo, then make WP as an external in the repo. I put it into a /wp directory. You can access the WP SVN as an external here: http://core.svn.wordpress.org/

I tend to use trunk. You can use a branch, if you really, really want. Branches get auto updated with minor releases (/branches/3.0 held 3.0, then 3.0.1, 3.0.2, etc), new branches get made for major releases.

Alongside it, I make a /name-content directory, where I'll put my custom themes and such. "name" is whatever you want it to be. Then I can use a custom /wp-config.php to change the location of the wp-content directory into my custom one, like so:

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/name-content' );
define( 'WP_CONTENT_URL', 'http://example.com/name-content');

For the themes, they go directly into the repo (since they're probably custom to the site) under /name-content/themes.

Any plugins I use I make a /name-content/plugins directory for, then set them to be externals from the http://plugins.svn.wordpress.org/pluginname/trunk repo. If you don't like running trunk (dangerous and that), then you can use the /tags/1.1 or whatever for them instead.

With a little bit of custom .htaccess logic (with the .htaccess file in the root of the repo) to make /wp the "root" of my domain, then the whole thing is setup. Example .htaccess file to move the root:

Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ wp/index.php [L]

This allows WordPress in the /wp directory to be at the root of your site, with it pointing to the name-content directory for the content aspects. The .htaccess won't redirect those requests (since the files exist) and thus everything works perfectly.

Advantage: When you want to update, a simple svn up updates the whole site, after you fiddle with the externals and such to point to the newer versions (if you're too chicken to run on trunk).

  • You have to be careful using the wordpress trunk, especially if you use it for multisite as it's in a state of flux and not garaunteed to work. I found that out the hard way when the super admin menu disappeared :) Commented Jan 17, 2011 at 10:22
  • True, but hey, what's life without living on the edge? ;)
    – Otto
    Commented Jan 17, 2011 at 21:38
  • I had high hopes for "simple" but this does look fun. Still waiting for the "use git" answer.
    – tooshel
    Commented Jan 17, 2011 at 22:01
  • Otto, my hero ... well explained solution ... I am going to give this a try right away. Been looking for something like this for a while!
    – farinspace
    Commented Mar 22, 2011 at 3:26
  • I made a post about this sort of setup a while back too: ottopress.com/2011/creating-a-wordpress-site-using-svn
    – Otto
    Commented Mar 23, 2011 at 2:38

I always check out from wordpress.org's svn repository, and then use svn externals to pull in my own themes/plugins. You don't have to use externals either, you can have your own themes and plugins checked out as their own working copies within the themes and plugins folders of your main WP checkout.

One advantage of the externals method is that you can update everything with a single command, just make sure you're checking out the right version of your own stuff.

Go to the themes/plugins folder and do the following:

sudo svn propedit svn:externals .

the structure of the externals file should be:

my-theme                 http://svn.example.com/my-theme/tags/1.0
my-other-theme    -r102  http://svn.example.com/my-other-theme/trunk

Akismet is included with WP as an external so if you navigate to the plugins folder and run the propedit command you will see an example.

The svnbook has more http://svnbook.red-bean.com/en/1.0/ch07s03.html

  • I really need to look into externals for subversion. Seems we use it more as a backup instead of source control.
    – tooshel
    Commented Jan 17, 2011 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.