我需要帮助来运行cron_schedules,实际上我开发了一个插件,它将从xml url导入woo-commerce产品。 请查看以下代码,让我知道问题是什么
add_filter( 'cron_schedules', 'woo_add_fively_cron_schedule' );
function woo_add_fively_cron_schedule( $schedules ) {
$schedules['fively'] = array(
'interval' => 300, // Once in Five minutes
'display' => __( 'Once in Five minutes' ),
);
return $schedules;
}
// Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'woo_my_cron_action' ) ) {
wp_schedule_event( time(), 'fively', 'woo_my_cron_action' );
}
// Hook into that action that'll fire weekly
add_action( 'woo_my_cron_action', 'woo_function_to_run' );
function woo_function_to_run() {
// Add some code here
$arr_feed=wp_list_table_import();
$no=20;
echo "aman here";
for ($i=0;$i<count($arr_feed);$i++)
{
$number=get_option('number_product');
if($number)
{
$no=$number;
}
import_product($arr_feed[$i]->url,$no);
}
}
请查看代码或告诉我如何追踪问题。