[updated: Sep 30th, 2018 | New easy and fully automated system for updating plugins – this is the “perfect” solution to this problem]

[updated: Feb 11th, 2018 | Updated script to deal with new format, syntax, urls]

LATEST UPDATE: Please checkout my “perfect” WordPress plugin update solution: http://blog.vpetkov.net/2018/09/30/easy-fully-automated-wordpress-plugin-update-system

Droidzone (Joel Mathew) has created a much more advanced fork of this with many improvements – check it out: http://blog.droidzone.in/2013/03/31/automatically-update-all-wordpress-plugins-from-bash/ (While I still very much support this, I believe my updated solution from Sept 30th, 2018 is incredibly easier and has a single dependency on “WWW::Mechanize”. Leaving the link here to Joel’s for anyone that is interested in taking a look at his. His original fork + extension supports good visual output and other options that someone may be interested in. I believe the last update was in 2014.)

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.

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

  1. @Droidzone – check out my updated version of this: https://blog.vpetkov.net/2018/09/30/easy-fully-automated-wordpress-plugin-update-system/

    I think this is probably the easiest and most reliable method for this. I’ve been testing it now for almost 2 years — sadly, I didn’t have the time to post about it here — and it has been truly perfect.

  2. 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. 🙂

  3. Pingback: Automatically update all Wordpress plugins from Bash

  4. 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.

    • 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. Good venture. I’ve rewritten it to add more options.


Leave a Reply

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

>> NOTE: Please use <code>...</code> to post code/configs in your comment.

Post Navigation