The MU forums have moved to WordPress.org

wp_schedule_event happens multiple times (wp cron) (1 post)

  1. mdgross
    Member
    Posted 14 years ago #

    I set wp_schedule_event to go off at ten minute intervals. It records the time at which it went off. I am noticing that event occurs multiple times between the ten minute intervals. I checked all of the cron processes and I am sure that there is no duplication. Why is the job happening too many times?

    add_filter('cron_schedules', 'more_reccurences');
    add_action( 'happens_every_ten_minutes', 'do_this_every_ten_minutes' );
    
    function more_reccurences() {
    	return array('tenmin' => array('interval' => 600, 'display' => 'Every Ten Minutes'));
    }
    
    if (!wp_next_scheduled('happens_every_ten_minutes')) {
    	wp_schedule_event( time(), 'tenmin', 'happens_every_ten_minutes' );
    }
    
    function do_this_every_ten_minutes() {
    	update_site_option('zzz-every_ten_minutes', date('m-d-y H:i:s A'));
    }

About this Topic

  • Started 14 years ago by mdgross