WordPress.org

Ready to get started?Download WordPress

Forums

cron_schedules not working (1 post)

  1. G0dLik3
    Member
    Posted 3 years ago #

    Hello,

    I am trying to add custom intervals for the WP cron.
    Here is the code:

    add_filter( 'cron_schedules', array('invit0r', 'filter_cron_schedules')  );
    ...
    function filter_cron_schedules($schedules) {
    
    		$schedules['every_minute'] = array(
    			'interval' => 60,
    			'display' => __( 'Once per minute' )
    		);
    
    		$schedules['every_five_minutes'] = array(
    			'interval' => 300,
    			'display' => __( 'Once five minutes' )
    		);
    
    		$schedules['every_ten_minutes'] = array(
    			'interval' => 600,
    			'display' => __( 'Once ten minutes' )
    		);
    
    		$schedules['every_fifteen_minutes'] = array(
    			'interval' => 900,
    			'display' => __( 'Once fifteen minutes' )
    		);
    
    		$schedules['every_half_an_hour'] = array(
    			'interval' => 1800,
    			'display' => __( 'Once half an hour' )
    		);
    
    		return $schedules;
    	}

    Yes, I am calling add_filter in a class called invit0r (it will be a plugin).

    add_filter fires the function, but it doesn't add the intervals. Does it have some kind of limit, not allowing intervals below one hour, or I am writing something incorrectly?

Topic Closed

This topic has been closed to new replies.

About this Topic