• I am using wp_schedule_event to run a cron inside my plugin php main file. The schedule work fine but then stopped any time without any reasons and then i have to deactivate and again reactivate the plugin to get this work. What can i do so the scheduling should not stop unexpectedly?

    function isa_activation(){
        if( !wp_next_scheduled( 'isa_add_every_three_minutes_event' ) ){
            wp_schedule_event( time(), 'every_three_minutes', 'isa_add_every_three_minutes_event' );
        }
    }
    register_activation_hook(   __FILE__, 'isa_activation' );
    // The deactivation hook
    function isa_deactivation(){
        if( wp_next_scheduled( 'isa_add_every_three_minutes_event' ) ){
            wp_clear_scheduled_hook( 'isa_add_every_three_minutes_event' );
        }
    }
    register_deactivation_hook( __FILE__, 'isa_deactivation' );
  • The topic ‘wp_schedule_event stopping without any reason’ is closed to new replies.