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

WordPress Trac noreply at wordpress.org
Thu Oct 22 15:43:53 UTC 2020


#51605: Cron hook does not receive $args array
------------------------------------+-----------------------------
 Reporter:  chadreitsma             |      Owner:  (none)
     Type:  defect (bug)            |     Status:  new
 Priority:  normal                  |  Milestone:  Awaiting Review
Component:  Cron API                |    Version:  5.5.1
 Severity:  normal                  |   Keywords:
  Focuses:  docs, coding-standards  |
------------------------------------+-----------------------------
 I have the following code:


 {{{
 add_action('my_cron_hook', 'do_cron_hook');
 function do_cron_hook($args) {

   print_r($args);
   exit();

 }
 }}}

 I have scheduled the hook to fire at a specific time with:
 wp_schedule_single_event() with the $args array('message_id' => 1234,
 'test' => 'test');


 When the hook fires - print_r only displays "1234" like the array has been
 disassociated. Why is the array not passed to the hook?

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


More information about the wp-trac mailing list