Skip to content

Instantly share code, notes, and snippets.

@irkanu
Created November 3, 2014 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irkanu/1998952f8c43c69f1a97 to your computer and use it in GitHub Desktop.
Save irkanu/1998952f8c43c69f1a97 to your computer and use it in GitHub Desktop.
Setup Cron to force onTransientUpdate to check hourly
/**
* 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