I have written a plugin that will convert posts to excel format and then email the .xls to an email id. I can make it work with when function is declared in functions.php but does not work with function defined in plugin file.
if ( ! wp_next_scheduled( 'xls_func_hook1' ) ) {
wp_schedule_event( time(), 'hourly', 'xls_func_hook1' );
}
add_action( 'xls_func_hook1', 'sendxls1' ); //senxls1 is a function in functions.php
if ( ! wp_next_scheduled( 'xls_func_hook2' ) ) {
wp_schedule_event( time(), 'hourly', 'xls_func_hook2' );
}
add_action( 'xls_func_hook2', 'export2excel' );
The full code is at Here