Created
November 3, 2014 22:33
-
-
Save irkanu/1998952f8c43c69f1a97 to your computer and use it in GitHub Desktop.
Setup Cron to force onTransientUpdate to check hourly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Building Cron-based hook to run periodic update checks and inject update info | |
* into WP data structures. | |
*/ | |
public function setupCron(){ | |
if ( $this->enableAutomaticChecking ) { | |
if ( !wp_next_scheduled('onTransientUpdate') ) { | |
wp_schedule_event(time(), 'hourly', array($this, 'onTransientUpdate')); | |
} | |
} else { | |
wp_clear_scheduled_hook('onTransientUpdate'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment