WordPress.org

Ready to get started?Download WordPress

Forums

WP-Optimize
[resolved] bug found in Scheduler code (4 posts)

  1. ls5302
    Member
    Posted 8 months ago #

    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://wordpress.org/plugins/wp-optimize/

  2. ruhanirabin
    Member
    Plugin Author

    Posted 8 months ago #

    Hi there, thanks for this.. btw can you please elaborate what is the difference between redefining and adding to it :)

  3. ls5302
    Member
    Posted 8 months ago #

    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

    Hope that help to explain it.

    Thanks.

  4. ruhanirabin
    Member
    Plugin Author

    Posted 8 months ago #

    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 :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.