[wp-trac] [WordPress Trac] #24160: ALTERNATE_WP_CRON runs wp_cron() too early

WordPress Trac noreply at wordpress.org
Tue Feb 2 03:09:09 UTC 2021


#24160: ALTERNATE_WP_CRON runs wp_cron() too early
------------------------------------+----------------------------
 Reporter:  r-a-y                   |       Owner:  peterwilsoncc
     Type:  defect (bug)            |      Status:  closed
 Priority:  normal                  |   Milestone:  5.7
Component:  Cron API                |     Version:  3.4
 Severity:  normal                  |  Resolution:  fixed
 Keywords:  has-patch early commit  |     Focuses:
------------------------------------+----------------------------
Changes (by peterwilsoncc):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"50135" 50135]:
 {{{
 #!CommitTicketReference repository="" revision="50135"
 Cron API: Run alternative wp-cron later, do not run on archived blogs.

 Runs cron jobs later on sites using alternative cron, ie the
 `ALTERNATE_WP_CRON` constant is true, to more closely match when standard
 cron jobs are run. Jobs now run on the `wp_loaded` hook at priority `20`.
 Prior to this change they would run on the `init` hook. This ensures
 custom post types and taxonomies are registered prior to the jobs running.

 This change also prevents alternative wp-cron from running on archived or
 suspended multisite blogs as these are shut down prior to the `wp_loaded`
 hook from running.

 Moves the existing functionality of `wp_cron()` in to a new private
 function `_wp_cron()`.

 Props flixos90, jeremyfelt, johnbillion, jrf, kurtpayne, nacin,
 peterwilsoncc, prettyboymp, r-a-y, ryan, stevenkword, swissspidy.
 Fixes #20537, #24160.
 }}}

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


More information about the wp-trac mailing list