[wp-trac] [WordPress Trac] #33534: Activation hook doesn't get called with the new plugin update?

WordPress Trac noreply at wordpress.org
Tue Aug 25 10:05:58 UTC 2015


#33534: Activation hook doesn't get called with the new plugin update?
-----------------------------+----------------------
 Reporter:  amonad           |       Owner:
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Upgrade/Install  |     Version:  3.1
 Severity:  normal           |  Resolution:  invalid
 Keywords:                   |     Focuses:
-----------------------------+----------------------
Changes (by swissspidy):

 * status:  new => closed
 * version:  4.2.3 => 3.1
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Since WordPress 3.1, this hook is fired only when the user activates the
 plugin and not when an automatic plugin update occurs. See #14915.

 You need to manually detect plugin updates in your code. Quote from
 [https://make.wordpress.org/core/2010/10/27/plugin-activation-hooks-no-
 longer-fire-for-updates/ this announcement post]:

 > The proper way to handle an upgrade path is to only run an upgrade
 procedure when you need to. Ideally, you would store a “version” in your
 plugin’s database option, and then a version in the code. If they do not
 match, you would fire your upgrade procedure, and then set the database
 option to equal the version in the code. This is how many plugins handle
 upgrades, and this is how core works as well.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33534#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list