[wp-trac] [WordPress Trac] #16897: wp_schedule_event with array of $args does not pass array to action
WordPress Trac
wp-trac at lists.automattic.com
Sat Mar 19 13:03:45 UTC 2011
#16897: wp_schedule_event with array of $args does not pass array to action
--------------------------+-----------------------------
Reporter: commentluv | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cron | Version: 3.1
Severity: major | Keywords:
--------------------------+-----------------------------
when I schedule an event with an array of $args , when the action is
called by the cron, it does not pass the callback function the array, it
sends a single string value.
action is registered with this
{{{
add_action('fhprw_action','fhprw_check_fetch');
function fhprw_check_fetch($args){
$type=$args['type'];
//do stuff according to $type
update_option('debug_args',$args);
}
}}}
when I use
{{{
do_action('fhprw_action',array('type'=>'uk'));
}}}
the option 'debug_args' is a serialised array as would be expected
` a:1:{s:4:"type";s:4:"uk";} `
but if an event is scheduled with
`wp_schedule_event(time()+60,'twicedaily','fhprw_action',array('type'=>'uk'));`
then when the event happens after 1 minute, the callback function receives
$args as a string 'uk'
the option 'debug_args' is a single string of
`uk`
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16897>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list