1

I've been able to work out how to programmatically get the installed plugin version numbers for all the plugins on a site, and the current available version numbers from the repository... but how can I find out what the current available version is for plugins like Gravity Forms that aren't in the repository?

I'm looking for something similar to what the WordPress plugin page is doing when it shows than an update is available - I want to be able to list what's there and what's available to update to.

The only thing that's got me stumped are the third party plugins not in the repository. I haven't been able to find a reference for what I assume must be an API using the plugin URI. Any suggestions?

3
  • 3rd party plugins that aren't in the repository will all have their own way of doing this. They'll all be different. There isn't a catch-all answer. Dec 12, 2019 at 1:20
  • I think you are looking for something like this check this question Dec 12, 2019 at 6:18
  • Yes, I did see that page actually, though it only showed how to get current version numbers from plugins in the repository. It actually was what helped me get the first half of what I'd hoped to do working. I had hoped that services like WP Remote or WPMUDEV hooked into something within WordPress that responded with plugin installed and current version numbers - looking for that was what led me to that linked question. But it seems like it would be impossible for them to stay on top of every individual non-repo plugin's method, for showing updates. Dec 13, 2019 at 3:44

2 Answers 2

2

I hate to be the bearer of bad news, but there is no general plugin update API, there is only the one Core uses when talking to .org, and it's the only implementation.

Some plugins use filters and hooks to add their own checks to this system, but most don't, or provide their own parallel bespoke checks. These are all highly dependent on the plugins themselves, and don't adhere to any standards.

The closest to a standard there is, are those plugins that provide private composer repos. But these are a minority, and I would struggle to name more than 2 or 3. These are also aimed at the composer CLI tool, composer wasn't designed to be used in a browser frontend, so you won't just be able to load it up and plumb it into the updates page. I estimate composer covers less than 1% of the ecosystem in this way

but how can I find out what the current available version is for plugins like Gravity Forms that aren't in the repository?

For Gravity Forms you will need to pick Gravity Forms apart to figure out how that plugin handles update checking. The same will be true of any other 3rd party plugin, and for a lot of them they may not have this.

For free plugins acquired via GitHub, just check GitHub, but be aware not everybody follows the same process. Some use releases, some use tags, some use branches, some don't and just commit to master, some use a different main branch, etc

I'm looking for something similar to what the WordPress plugin page is doing when it shows than an update is available - I want to be able to list what's there and what's available to update to.

This does not exist

I haven't been able to find a reference for what I assume must be an API using the plugin URI.

This does not exist.

2
  • I was afraid this might be the case, after not being able to find any examples after hours of Googling. :-/ I had hoped that WordPress had some method it used when displaying available updates on the plugin list, but if I understand you correctly, it's relying on each plugin to provide this? I don't suppose there's anything in WordPress to hook into at a layer above the individual coding that each plugin chooses to use? Dec 13, 2019 at 3:41
  • That's correct, if you aren't on .org, you need to provide your own plugin update mechanism, with your own implementation. Some plugins hook into the built in updater so they can use the same UI, but a lot of plugins make no attempt at all to update, and some just make an AJAX request somewhere offsite and depending on the result show a bit of bespoke update UI in the admin. Most plugins don't check for updates at all, or don't rely on the built in updater ( e.g, for some of my plugins, the update method is to run git pull and if anything gets pulled down then yay you updated )
    – Tom J Nowell
    Dec 15, 2019 at 12:20
0

If you are talking about plugins that come from the WP Repositories, you should check this: https://codex.wordpress.org/WordPress.org_API#Plugins

In case you are looking for "premium" plugins that are not hosted under the umbrella of WP.org site, you will have to sort out their API URL for versioning which generally shall be hardcoded somewhere inside their code.

For example, Crocoblock plugins use this API: https://api.crocoblock.com?action=get_plugins_data

But this is not a default solution: it may change from plugin to plugin as long as they are updated outside the WP.org SVN repositories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.