puzzling.org · mary.gardiner.id.au

Wordpress

Upgrading WordPress with rsync

WordPress upgrades are a pain in the neck. You're meant to unpack. copy, delete some files, add some files, stir.

Step 1: back up everything.

If you know rsync, and you've checked the upgrade instructions for what files you should preserve (usually it's the wp-content dir, wp-config.php and .htaccess but no guarentees), and you've unpacked the new WordPress source to WORDPRESSLOC, change to the directory where your WordPress directory:

rsync -av --exclude .htaccess --exclude robots.txt --exclude "*wp-content*" --exclude wp-config.php --delete-after WORDPRESSLOC/ .

Note that this does delete files that aren't in the --exclude settings and that aren't found in WORDPRESSLOC, which should mean out-of-date PHP files but which might also mean custom files you put in there. Triple check the directory contents and the --exclude settings.

Sometimes the wp-content directory has updated files, but you don't want to overwrite your own themes and plugins. You can upgrade it like this:

cd wp-content/
rsync -av WORDPRESSLOC/wp-content/ .

After all this, you still need to visit http://YOURWORDPRESSSITE/wp-admin/upgrade.php to upgrade the database values.

Last modified: 15 April 2009