Opened 6 years ago
Last modified 6 years ago
#50674 accepted enhancement
Plugin and Theme Update Hooks
| Reported by: | davidbaumwald | Owned by: | pbiron |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Upgrade/Install | Version: | |
| Severity: | normal | Keywords: | 2nd-opinion needs-patch |
| Cc: | Focuses: |
Description
With plugin and theme auto-updates shipping with core in 5.5, I think it's worth considering adding some more hooks around the plugin and theme process to perhaps run prior to and after a particular update is run. Hooks like plugin_updated and theme_updated, and maybe some pre_* versions of those.
Change History (11)
#1
@
6 years ago
#2
@
6 years ago
I had considered upgrader_process_complete for my specific use-case, but you have to weed through a bunch of data to determine the object being updated. I was thinking of more granular hooks that fired globally when a plugin/theme is updated, auto or manual.
This ticket was mentioned in Slack in #core-auto-updates by pbiron. View the logs.
6 years ago
#5
@
6 years ago
@davidbaumwald Do you still have need for more specific hooks? If so, can you provide use cases where existing hooks don't work? If not, feel free to close this :-)
#6
@
6 years ago
@pbiron It's not that the existing hooks "don't work" for the use-cases I've encountered. The request here is a quality of life enhancement. Instead of digging through the existing hooks to determine the type and item(s) affected, it would be nice to have more granular filters that apply to a specific update type and pass a single item.
Since plugin and theme auto-updates are now part of core, the number of potential use-cases for these types of hooks has increased for developers who need to detect when things update, since they can now be unattended.
#7
@
6 years ago
- Milestone Awaiting Review → 5.6
- Owner set to
- Status new → accepted
Sorry if I wasn't clear: I'm definitely not against adding additional hooks...just looking to you to tell us which new hooks to add :-)
I'm adding this to the 5.6 milestone.
#8
@
6 years ago
@pbiron They could either be dynamic:
do_action( "pre_upgrade_{$type}", $type, $object );
Or they could be split up into the individual skins and set to static, like:
do_action( 'pre_upgrade_plugin', $object );
It would also be nice to have the upgrade_XXX companions to fire _after_ the upgrade is processed.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@davidbaumwald
WP_UpgraderandWP_Automatic_Upgraderalready have a number of hooks like that, e.g.Do you specific use cases that those don't cover?