Hiper Cron Job
// Scheduled Action Hook
function hiper_cron_job_sync_products( ) {
}
add_action( 'hiper_cron_job_sync_products', 'hiper_cron_job_sync_products' );
// Custom Cron Recurrences
function hiper_cron_job_recurrence( $schedules ) {
$schedules['half_hourly'] = array(
'display' => __( 'A cada 30 minutos', 'textdomain' ),
'interval' => 1800,
);
return $schedules;
}
add_filter( 'cron_schedules', 'hiper_cron_job_recurrence' );
// Schedule Cron Job Event
function hiper_cron_job() {
if ( ! wp_next_scheduled( 'hiper_cron_job_sync_products' ) ) {
wp_schedule_event( current_time( 'timestamp' ), 'half_hourly', 'hiper_cron_job_sync_products' );
}
}
add_action( 'wp', 'hiper_cron_job' );