Thoughts and opinions of a technology enthusiast.

WordPress Upgrade Script

For those of you who run your own blogs, and take care of the updates yourselves, I’ve created a WordPress Upgrade script. Note: This is a Linux/Unix/Mac OS X shell script, not a Windows batch file.

The script is very simple:

  1. Download the latest WordPress archive from the website
  2. Uncompress it to a temporary location
  3. Migrate all of the themes, plugins and uploads
  4. Copy over wp-config.php
  5. Back up the old version
  6. Move the new version into the proper folder

Inspiration for this came with this week’s WordPress 2.1.1 update. I figured if I have to keep up with all the security updates, I might as well just build a script to simplify matters.

Download a copy of the script from here.

Questions, comments, compliments or constructive criticism will be gladly accepted!

Category: Uncategorized
  • Evamaria says:

    Found this via your comment to the upgrade instructions via shell access and will probably use it in the future for my various manually updated WP installations. Just one (probably stupid) question: Do I copy your script completely into the Terminal, or do I go line by line? I’ve never used a shell script before, only very basic shell commands (cd, wget, rm, rar, etc.), so I want to make sure I do it right… Thanks in advance!

    March 3, 2007 at 1:55 pm
  • Simon B says:

    i maintain about 15 WP sites for customers, so something like this could save me hours!

    however, i’m a complete newbie at scripting, so could you tell me how i run the script? i’m running windows on my pc, so i use winscp to connect to my server, then from within winscp i open a putty window. how do i run your script from putty?

    i’ve noticed also that the value for prodfolder is hardcoded into the script – is it possible to pass this in as a parameter?

    sorry for all the questions…!

    March 4, 2007 at 8:46 am
  • Keith says:

    ##Evamaria & ##SimonB, I think that these instructions should help both of you:

    1. Connect to your server via SSH
    2. Download the script: wget http://krell.cellsandbytes.net/wp-content/uploads/wp-upgrade
    3. Place the file in the parent to your wordpress installation(s)
    (ie. if wordpress is in /myuser/www/myWPsite then the script should be at /myuser/www/wp-upgrade

    The script was designed originally to upgrade a single instance of WordPress, if you have several to upgrade you will need to run the script multiple times.

    ##SimonB — The PROD_FOLDER variable is set to a default in the script, but you can pass a parameter to the script specifying which folder contains your WP installation: wp-upgrade myWPsite

    March 4, 2007 at 1:10 pm
  • Walter says:

    You should copy .htaccess as well.

    March 4, 2007 at 4:09 pm
  • Martijn Stegink says:

    It doesn’t quite work on Osx. Wget was replaced with curl there and some other stuff didn’t work either. Didn’t figure it out yet.

    April 9, 2007 at 1:22 pm
  • Keith says:

    The WGET problem can be resolved with this: http://krell.cellsandbytes.net/wp-admin/post.php?action=edit&post=131
    If you have any ideas what the other problems might be, let me know and I’ll see if I can make a more generally useful version of the script. :)

    April 13, 2007 at 5:14 pm
  • eric says:


    isn’t it necessary to disable all the plugins before upgrading?
    otherwise, nice script, which I’ll probably use on my wordpresses :)

    April 16, 2007 at 5:19 am
  • Keith says:

    Not sure how I missed your comment from last month, Eric. To my knowledge the plugins don’t _need_ to be disabled, but I’ll do some additional reading on the topic and see if I can come up with an answer in the next version of the script. :)

    May 20, 2007 at 10:05 pm
  • Gary LaPointe says:

    The script doesn’t seem to be there any more…

    December 30, 2007 at 7:43 pm
  • kdmurray says:

    @Gary: The link has been corrected. Thanks.

    January 3, 2008 at 10:01 pm

Your email address will not be published. Required fields are marked *