Title: bug found in Scheduler code
Last modified: August 21, 2016

---

# bug found in Scheduler code

 *  Resolved [ls5302](https://wordpress.org/support/users/ls5302/)
 * (@ls5302)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/bug-found-in-scheduler-code/)
 * Hi,
 * You have a serious bug in the wpo_cron_update_sched function, you are redefining
   the $schedules rather than adding to them. Code should look like this:
 *     ```
       function wpo_cron_update_sched( $schedules ) {
       $schedules['weekly'] = array('interval' => 60*60*24*7, 'display' => 'Once Weekly');
       $schedules['otherweekly'] = array('interval' => 60*60*24*14, 'display' => 'Once Every Other Week');
       return $schedules;
       }
       ```
   
 * [http://codex.wordpress.org/Function_Reference/wp_get_schedules](http://codex.wordpress.org/Function_Reference/wp_get_schedules)
 * [http://wordpress.org/plugins/wp-optimize/](http://wordpress.org/plugins/wp-optimize/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Ruhani Rabin](https://wordpress.org/support/users/ruhanirabin/)
 * (@ruhanirabin)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/bug-found-in-scheduler-code/#post-4263715)
 * Hi there, thanks for this.. btw can you please elaborate what is the difference
   between redefining and adding to it 🙂
 *  Thread Starter [ls5302](https://wordpress.org/support/users/ls5302/)
 * (@ls5302)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/bug-found-in-scheduler-code/#post-4263752)
 * Hi,
 * Other plugins add schedules e.g. JetPack adds a jetpack_weekly. All these schedules
   are stored in the same array which is passed around and added to by the cron_schedules
   filter. Your code is returning a new array, rather than just adding new entries
   to the existing array.
 * I stumbled across the problem when the TablesPress auto-import plugin stopped
   auto-importing. It took a while but i noticed the “Every 15 minutes” schedule
   had vanished – it was being overwritten within the wpo_cron_update_sched method.
 * I found an example on how to add schedules here:
    [http://codex.wordpress.org/Function_Reference/wp_get_schedules](http://codex.wordpress.org/Function_Reference/wp_get_schedules)
 * Hope that help to explain it.
 * Thanks.
 *  Plugin Contributor [Ruhani Rabin](https://wordpress.org/support/users/ruhanirabin/)
 * (@ruhanirabin)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/bug-found-in-scheduler-code/#post-4263753)
 * I see, ok I am going to test out your code. Thank you so much for letting me 
   know about this. Really appreciate your help 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘bug found in Scheduler code’ is closed to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Ruhani Rabin](https://wordpress.org/support/users/ruhanirabin/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/bug-found-in-scheduler-code/#post-4263753)
 * Status: resolved