Support » Fixing WordPress » using wp_schedule_event

  • I’m developing a plugin that uses wp schedule event, but I can’t get it to fire. Here’s my code:

    function more_reccurences() {
    return array(
    'everyminute' => array('interval' => 60, 'display' => 'Once Every Minute'),
    );
    }
    add_filter('cron_schedules', 'more_reccurences');
    
    register_activation_hook(__FILE__, 'mails_activation');
    add_action('mail_event', 'check_for_mails');
    
    function mails_activation() {
    	wp_schedule_event(time(), 'everyminute', 'mail_event');
    }
    
    function check_for_mails() {
    	global $wpdb;
    
    	$message = "Line 1\nLine 2\nLine 3";
    	$message = wordwrap($message, 70);
    	mail('caffeinated@example.com', 'My Subject', $message);
    
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘using wp_schedule_event’ is closed to new replies.