• My php version is : 5.2.17
    Currently running WordPress 3.6

    I am building a plugin that requires cron jobs functionality of wordpress.

    By code on activation, I added a ten minute interval to the cron schedule as shown in code below:

    add_filter( 'cron_schedules', 'cron_add_tenmin' );
    //add a every ten min cron
    function cron_add_tenmin( $schedules ) {
     	// Adds once weekly to the existing schedules.
     	$schedules['tenmin'] = array(
     		'interval' =>  600, //inseconds
     		'display' => __( 'Once Every Ten Minute' )
     	);
     	return $schedules;
     }

    Then i add the cron job i wanted:

    add_action( 'wp', 'prefix_setup_schedule' );
    function prefix_setup_schedule() {
    // Add Cron Schedule
    	if ( !wp_next_scheduled( 'my_reset_list_event' ) ) {
    		wp_schedule_event( time(), 'tenmin', 'my_reset_list_event' );
    	}
    }
    
    add_action( 'my_reset_list_event', 'my_reset_list' );
    function my_reset_list(){
    //the main function
       require_once( plugin_dir_path( __FILE__ ) . 'inc/reset.php');
    }

    I did it all according to wordpress codex.

    This cron job did get into the schedules however when i check with my debug bar plugin with cron debug, i noticed nothing is running.

    The next execution for my_reset_list_event should be in the next 10minutes, but the debug bar for this cron job says the next execution is already passed,(1 min ago).

    For other wordpress default cron jobs and other plugin cron jobs, the same problem, their Next Execution is also in AGO format.

    I tried waiting for 10min and my cron job is not executed.

    I confirmed that “inc/reset.php” is working properly when executed manually.

    I hope someone can provide me some guidelines.
    If can, I would also want to know how to reset all the cron jobs(restore to defualt). I fear i messed up something and caused this.

  • The topic ‘Cron jobs not running [WP 3.6]’ is closed to new replies.