How to Add a Custom Cron Interval

WP RSS Aggregator, by default, provides a list of cron intervals for scheduling your feed imports. Although these work for the majority of users, you may want a different schedule.

Use the below code to add a new cron and see it show up in the list shown in the WP RSS Aggregator settings. You can set the number of seconds and the display name as you wish.

add_filter( 'cron_schedules', 'cron_add_weekly' );


function cron_add_weekly( $schedules ) {
   // Adds once weekly to the existing schedules.
   $schedules['weekly'] = array(
    'interval' => 604800, // 60sec*60min*24hours*7days
    'display' => __( 'Once Weekly' )
   );
   return $schedules;
}

IMPORTANT: To learn how to add this code to your site, please visit our tutorial here.

Still need help? Contact Us Contact Us