[wp-hackers] Problem with wp_schedule_single_event

Sudar Muthu sudar at sudarmuthu.com
Thu Mar 20 18:13:40 GMT 2008


Hi all,

I am facing a strange problem with wp_schedule_single_event function when
passing parameters to the callback function.

The following is my condensed code

wp_schedule_single_event(time()+3600, 'my_custom_hook', $data );
add_action('my_custom_hook','my_function')
function my_function($data) {
//print $data
}

My aim is to pass the parameter $data to my_function(), but the above code
is not working for me. The $data variable inside the my_function is always
set to null.

The documentation for the wp_schedule_single_event at
http://codex.wordpress.org/Function_Reference/wp_schedule_single_event says
that we can pass the arguments for the callback function as the third
parameter but it doesn't seem to work for me. Am I missing something here?


-- 
With Regards,
Sudar

http://SudarMuthu.com


More information about the wp-hackers mailing list