Make WordPress Core

Opened 13 years ago

Closed 12 months ago

#18471 closed enhancement (duplicate)

Add action hook after cron processed it's jobs

Reported by: tott's profile tott Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Cron API Keywords: has-patch
Focuses: Cc:


Sometimes it's hard to debug cron jobs or validate the results. A simple action fired after the wp-cron.php did his magic could help improve this experience.

Attachments (3)

wp-cron-action-hook.diff (230 bytes) - added by tott 13 years ago.
Add action hook to wp-cron.php
22143.diff (455 bytes) - added by batmoo 12 years ago.
18471.patch (733 bytes) - added by jrtashjian 9 years ago.

Download all attachments as: .zip

Change History (14)

13 years ago

Add action hook to wp-cron.php

#1 @danielbachhuber
13 years ago

  • Cc wordpress@… added

#2 @nacin
12 years ago

#22143 was marked as a duplicate.

#3 @toscho
12 years ago

  • Cc info@… added

#4 @scribu
12 years ago

  • Keywords has-patch added

I guess using the 'shutdown' hook wouldn't do, since you would want access to the jobs just completed.

How about calling the hook 'did_cron' instead?

Last edited 12 years ago by scribu (previous) (diff)

12 years ago

#5 @batmoo
12 years ago

Added patch from #22143; it fires the action immediately after the event has executed and passes in some args specific to that event.

This ticket was mentioned in IRC in #wordpress-dev by danielbachhuber. View the logs.

10 years ago

#7 @mnelson4
9 years ago

I found myself wanting a hook like this too. The shutdown hook was a little too late for my application (and I wouldn't want my code to step on the feet of other shutdown code)

#8 @The Plugin Factory
9 years ago

I too would like this functionality. Anyone know what the next closest hook is in the flow of loading things?

9 years ago

#9 @jrtashjian
9 years ago

This patch is an update to @batmoo with documentation added so it can be pushed in a future release. I changed the last parameter from $v to $v['args'] because we shouldn't need to return the results of wp_reschedule_event() (which modifies $v specifically for rescheduling).

I left out @since from the comment as I wasn't sure when this would be added.

Also just referencing this is for Contributor Day at WordCamp US 2015! :)

#10 @jrtashjian
9 years ago

Mentioning here as well: #28635 is probably the better method which adds many more hooks and adds an exit handler.

#11 @johnbillion
12 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing this off in favour of #28635

Note: See TracTickets for help on using tickets.