Automatic Updates for WordPress Plugins

Automatic Updates for WordPress Plugins

Having just completed another update to a WordPress plugin that is specific to our clients and having to push that change out the 100+ sites running them made we wistful for the luxury that plugin developers who host on WordPress.com’s directory have. They can update in one location and all their clients will automatically be notified (in their site control panel) that the plugin needs to be updated and provide a simple mechanism to do so.

I had long hoped to find a way to do this for out plugins but the complexity from most solutions that I’d found made it seem¬†hardly worth the effort. That was until I stumbled on an old post by Janis Elsts at W-Shadow.com. His relatively clear instructions along with the requisite files made it a rather trivial issue to integrate this vital feature into my latest plugin.

There are 4 basic steps to do this:

  1. Post your the current version of your plugin’s ZIP file at a publicly-accessible, consistent URL that you’ll use in the configuration of the JSON metadata file in step 2.
  2. Create a JSON file that contains all the metadata that WordPress will require to determine the current version and present it to the end user. This file needs to be hosted at a publicly-accessible, consistent URL that you’ll use later in the configuration of your plugin’s primary file. Below is a sample minimum configuration:
  3. Add the /plugin-updates/ folder found in his Client Library to your plugin.
  4. Add the following code to the primary file of your plugin.

Things to remember are:

  • When creating your .zip file, be sure to use place all your files not in the root of your zip file but in a folder that is the same name as the slug. This is the folder that WordPress will install your plugin into.
  • If your plugin uses a class file
  • See Janis’ notes in his blog file if for some reason you need to use a specific version of the client library if other plugins are using the PucFactory::buildUpdateChecker(); class/method and it is different than yours.

Happy coding!

Stalk Me...

Michael Gibbs

I'm a technologist at heart, assisting companies best utilize the Internet to market themselves and sell their products and services online. This includes organizations as large as Google and as small as one or two individuals.
At Over The Top and Exhibit A Communications, I've programmed solutions for Google as well as at least one other company that was later acquired by Google.

I've been CTO of an Internet SaaS company and spent my time pretty evenly between guiding the future technical strategy of the company, architecting software solutions for my dev teams, designing and running a data center to service our clients world-wide as well as being a technical evangalist/sales engineer to our media clients large and small.

I've also been Chief Photographer of the Daily Sun/Post newspaper back when it was a 5-day a week daily newspaper.

I also spent a great many years as a beach lifeguardfor the City of San Clemente as well as Jr. Lifeguard instructor and then as it's program coordinator.
Bragging rights
Private Pilot with Instrument rating and proud husband of soon to be 25 years (and counting).
Stalk Me...

Latest posts by Michael Gibbs (see all)

Leave a Reply