For its cron functionality, WordPress has three defined intervals:
- Hourly
- Twicedaily
- Daily
However, you can also create your own interval as follows (weekly as an example):
[php]
add_filter( ‘cron_schedules’, ‘cron_add_weekly’ );
function cron_add_weekly( $schedules ) {
// Adds once weekly to the existing schedules.
$schedules[‘weekly’] = array(
‘interval’ => 604800, // 60*60*24*7
‘display’ => __( ‘Once Weekly’ )
);
return $schedules;
}
[/php]
If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.