I’m writing a plugin that checks and collects data from WP – including info about installed plugins.
I can get most of the data I require using get_plugins()
– however, I’d also like to check for the latest repository hosted version of each plugin – but I can’t seem to find an API method for this.
Sorry, I’ve got no code to paste for commenting.. but I’ve had a good search around – honest!
Where I can find a simple and efficient way to check?
Ok – here is a method – thanks to @Rarst for pointing me in the right direction.
Include the require file if the plugins_api function is not found:
Then, prepare a query to pass to plugins_api():
ref: http://wp.tutsplus.com/tutorials/plugins/communicating-with-the-wordpress-org-plugin-api/
There is not quite simple way to do it, since WP check for plugin updates by submitting all their data in bulk and it’s pretty buried in
wp_update_plugins()
.It performs request to
http://api.wordpress.org/plugins/update-check/1.1/
API endpoint and gets data about all updates. It’s not available as more contained function for individual checks.You could also look into Plugin Information API to approach this from repository side.