[updated: Dec 20th, 2012 | Updated script to deal with new URL and pulling short descriptions now]

UPDATE: Please check out latest version from my git repo: http://git.vpetkov.net/projects – project name: “wordpress”

UPDATE2: Forgot to mention – a MUCH nicer fork of this + many improvements by Droidzone: http://blog.droidzone.in/2013/03/31/automatically-update-all-wordpress-plugins-from-bash/

Please take a look at his version!

I already created a script to upgrade wordpress installations automatically. You can find it here: http://blog.vpetkov.net/2011/06/01/script-to-upgrade-wordpress-to-the-latest-version-fully-automatically Recently, the same general problem came about when it came to plugins. The biggest problem I had is that I had to log-into wordpress, see a number of plugins that were outdated, and then go hunt each one down by generally just copying the name and pasting it into google . Even thought most of the time, the plugin was the first hit, I then had to download the latest version, extract it, and clean it up. Imagine doing this for 10+ plugins for 5+ blogs — constantly. It was just time consuming and frustrating.

Here is my solution in the form of a perl script:

This script can be used in one of two ways:

1.) You can simply run it, and it will update everything that you have listed in the @plugins array.

2.) You can give it a parameter of a registered plugin name. This does 2 jobs — upgrades an existing plugin, AND installs new ones.

You can definitely add an extension to this. For #1, you can go a step further by making it scan your plugin directory and populating the list from there. If you want to be even fancier, you can relatively easily keep version tracks of what you have installed and what’s currently available, so that you don’t just blindly download new plugins. For me this is sufficient. If anyone is interested in getting help implementing any of these extra additions, feel free to ask and I’ll help as much as I can.

6 Thoughts on “Script to Upgrade Plugins on WordPress to the latest version fully automatically

  1. Good venture. I’ve rewritten it to add more options.


  2. Ventz on March 31, 2013 at 1:28 am said:

    Awesome. Thanks for sharing, and thanks for the credit!

  3. I’m currently adding code to compare the version of installed plugins and download only if they’re older. That should make it even faster and replicate what wordpress does.

  4. Ventz on March 31, 2013 at 1:39 am said:

    That’s a great idea. I was going to expand this originally, but I didn’t have much time when I first wrote it, and I kept relying on WP telling me when a plugin needed an update, and just putting the name and updating it from the CLI. I honestly can’t believe that WP will not do this automatically (yes, it would need a web server writable directory, but that shouldn’t be a problem). Either way, I can update this version with your updates/changes eventually. It seems a lot of people are interested in this functionality (this page gets viewed a few thousand times a month).

  5. Pingback: Automatically update all Wordpress plugins from Bash

  6. The completed script along with the writeup: http://blog.droidzone.in/2013/03/31/automatically-update-all-wordpress-plugins-from-bash/

    I will probably be doing some more modifications to add features. Those should appear on the git repo. For now, it’s fully functional. It checks for updated versions on the site, finds the version of current plugins, and downloads only if there are updates. I added liberal use of colorization, added debug options, help on arguments etc. Feel free to update your post or link to my github, or anything you like. Thank you for the awesome idea! 🙂 The advantage of the perl script is that it can work easily from cron. 🙂

Leave a Reply

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

Post Navigation