Search code examples
wordpresswordpress-rest-api

Notify When Update(s) Performed


I'm looking to create a tally of the number of core, theme and plugin updates performed on a given WP installation. I envisage that this would involve creating an option into which I store and int value that is incremented every time a core, theme &/or plugin update is successfully performed.

To enable this I was hoping for some hooks are called when each of these update types are performed. However, I can't seem to find any relevant hooks for plugin and theme updates.

For core updates, it looks like I can simply increment the relevant options field whenever the '_core_updated_successfully' hook is called.

Are there any relevant hooks available for plugins and themes? Can you suggest an alternative methodology?

Thanks in advance.


Solution

  • You can run the upgrader_process_complete action hook. it runs when the download process for a plugin install or update finishes. It takes a type parameter for core, plugin or theme.