Hooks for Start/End of Batch Plugin Updates in wordpress
We’re trying to get a hook to run before wordpress updates and after wordpress updates.
We’d like this hook to run whether it’s
a)through the admin panel in these two cases:
1 – single plugin update that is ran,
2 – or a batch plugin update, by checking multiple checkboxes, and clicking the actions menu and clicking on update.
b) through wp cli.
We’ve tried:
upgrader_package_options
upgrader_pre_install
upgrader_process_complete
upgrader_post_install
But the results have been that they run N x 2 number of times. Meaning if you check off 3 plugins to be updates, they will fire off 3 x 2 = 6 times. 3 for the pre hook and 3 for the post hook.
We’ve also looked at this popular article but it would only work for when plugins are updated through the admin panel.
We’re essentially looking for a way to process a pre command and post command no matter how the update occurs.
Leave an answer