我写了一个插件,可以将帖子转换为excel格式,然后通过电子邮件发送。xls到电子邮件id。我可以在函数中声明函数时使用它。php,但不能使用插件文件中定义的函数。
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\' );
完整代码位于Here