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('', 'My Subject', $message);
Viewing 1 replies (of 1 total)
  • David Miller


    Your value for $recurrance (‘everyminute’) is not valid. The only valid values are ‘hourly’, ‘twicedaily’, and ‘daily’

    I created a plugin that I wanted to fire every five minutes so I set 12 scheduled events with times 5 minutes apart that all called the same hook and with an ‘hourly’ recurrance.

    See for more info on wp_schedule_event.

Viewing 1 replies (of 1 total)
  • The topic ‘using wp_schedule_event’ is closed to new replies.