4

I am a wp plugin developer and I'd like to know how WP detects when some plugin has an update? I guess it is ok for these plugins which are already in wordpress.org repository. But how I can implement the same mechanism for these plugins which are stored in my own repository? (Already made some googling, unfortunately can't find any info). Thanks!

1 Answer 1

7

Every 12+ Hours WordPress automatically goes out and checks if a plugin needs to be updated via the WordPress Repository. There's 3 cron jobs that WordPress runs to check on things:

  • wp_version_check - Checks for Core Updates
  • wp_update_plugins - Check for Plugin Updates
  • wp_update_themes - Checks for Theme Updates

A neat little plugin to view these is WP Crontrol. Now, WP Crons are not like Server Cronjobs, they run during specific situations when conditions are met ( current_time >= 12 AND ... ). I'm not entirely sure what the conditions are but they seem to be admin-panel requests.

There's an options in the database that holds a lot of this information, each cron has it's own transient if I'm not mistaken, you can search you wp_options table for _site_transient with a LIKE%..% statement to see what you get.

_site_transient_update_plugins Option holds information such as last checked timestamp, plugins checked, plugins that need updated ( with an array of things such as package URL, new version, etc. ) which is then used to both get and display information to the user about updating and makes it super easy for a user to simply click update ( as it doesn't need to look for the page it already has the update URL in the database ).

I've played around with this for a little bit and still don't have a full grasp on it but hopefully the above gives you an idea of how it works.

As far as having WordPres update plugins for your own private repository, there's a few different flavors of it. WooCommerce has a helper plugin that handles most their updates, there's some code to push updates from Github, here's an answer that pushed me in the right direction. All in all it's not the easiest / most straight-forward thing to do.

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.