Created
June 2, 2020 14:40
Add custom cron schedules with filter `cron_schedules`. See https://maheshwaghmare.com/doc/wordpress-cron/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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