[wp-trac] [WordPress Trac] #37678: Add an action hook for plugins to do database upgrades on

WordPress Trac noreply at wordpress.org
Tue Aug 16 18:11:00 UTC 2016


#37678: Add an action hook for plugins to do database upgrades on
-----------------------------+-----------------------------
 Reporter:  johnjamesjacoby  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Database         |    Version:
 Severity:  normal           |   Keywords:  2nd-opinion
  Focuses:                   |
-----------------------------+-----------------------------
 Currently, plugins that have custom database tables usually hook into
 `admin_init` and pray for rain when comes to their database alterations.
 This pollutes the `admin_init` hook namespace quite a bit, particularly
 with database actions that are almost always necessary in order for
 plugins to actually work correctly.

 It would be nice if WordPress core had a dedicated action hook meant for
 executing database alterations & upgrades, no different than there being
 one for `plugins_loaded`, `template_redirect`, et all...

 I'm conflicted on where exactly this hook should be. I'm 95% sure it
 belongs somewhere after `admin_init` so that admin area plugins have a
 chance to hook everything in. I'm also 95% certain I don't want this as
 part of the plugin activation sequence, because it's becoming more common
 to deploy plugins via WP CLI, version control, or some other deployment
 process, and activation hooks aren't usually ran that way.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37678>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list