Minimal Cron
Change the following:
- Prefix: svd_
function svd_deactivate() {
wp_clear_scheduled_hook( 'svd_cron' );
}
add_action('init', function() {
add_filter( 'cron_schedules', 'svd_schedule_cron' );
add_action( 'svd_cron', 'svd_run_cron' );
register_deactivation_hook( __FILE__, 'svd_deactivate' );
if (! wp_next_scheduled ( 'svd_cron' )) {
wp_schedule_event( time(), 'minute', 'svd_cron' );
}
});
function svd_schedule_cron( $schedules ) {
$schedules[ 'minute' ] = array( 'interval' => 1 * MINUTE_IN_SECONDS, 'display' => __( 'Every 1 minute.', 'svd' ) );
return $schedules;
}
function svd_run_cron( ) {
// Do your stuff!
}