[wp-trac] [WordPress Trac] #51605: Cron hook does not receive $args array

WordPress Trac noreply at wordpress.org
Thu Oct 22 15:52:14 UTC 2020


#51605: Cron hook does not receive $args array
--------------------------+-------------------------------------
 Reporter:  chadreitsma   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Cron API      |     Version:  5.5.1
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:  docs, coding-standards
--------------------------+-------------------------------------
Changes (by johnbillion):

 * resolution:  invalid => worksforme
 * milestone:  Awaiting Review =>


Comment:

 That's correct, each parameter in `$args` gets passed to the event
 callback as an individual parameter. You should use a numerically indexed
 array instead of an associative array in your code.

 The docs for this do explain this but it's quite difficult to explain
 succinctly, and you're definitely not the first person to have this
 problem.

 While the behaviour cannot be changed, the docs can certainly be improved,
 so if you have any suggestions they're very welcome.

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


More information about the wp-trac mailing list