Add custom cron schedules with filter `cron_schedules`. See https://maheshwaghmare.com/doc/wordpress-cron/
<?php | |
/** | |
* Add Cron Schedules | |
* | |
* @todo Change the `prefix_` and with your own unique prefix. | |
* | |
* @since 1.0.0 | |
* | |
* @param array() $schedules Existing schedules. | |
* @return array | |
*/ | |
if( ! function_exists( 'prefix_add_cron_schedules' ) ) : | |
function prefix_add_cron_schedules( $schedules = array() ) { | |
$schedules['every_ten_minutes'] = array( | |
'interval' => 600, // 600 seconds means 10 minutes. | |
'display' => __( 'Every 10 minutes', 'textdomain' ), | |
); | |
return $schedules; | |
} | |
add_filter( 'cron_schedules', 'prefix_add_cron_schedules' ); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment