Monday, August 15, 2011

Custom time or interval for Cron to Wordpress

If you want to specify another interval to run a cron job in Wordpress beside the 3 built in you can do so. The custom code for specify another cron interval is:

add_filter( 'cron_schedules', 'my_corn_schedules');
function my_corn_schedules(){
return array(
'per_minute' => array(
'interval' => 60,
'display' => 'Every Mintue'
)
);
}

Interval is how many seconds in between. And display is an value for naming the interval or custom cron interval. Remember that when you are creating a cron job with the built in cron function in Wordpress, the cron job triggers by a user when the user is visiting your website.