Skip to content

Instantly share code, notes, and snippets.

@elimn
Created November 10, 2016 22:38
Show Gist options
  • Select an option

  • Save elimn/6220631c52527a406823c390f95cb93c to your computer and use it in GitHub Desktop.

Select an option

Save elimn/6220631c52527a406823c390f95cb93c to your computer and use it in GitHub Desktop.
MT | ECP | Have ECP append and trim recurrences every hour instead of every day
<?php
/**
* Tells ECP to append and trim recurrences every hour instead of every day.
*
* @see (wp filter) schedule_event
*
* @return mixed
*/
function tribe_alter_recurrence_rebuild_schedule( $event ) {
if (
class_exists( 'Tribe__Events__Pro__Recurrence__Scheduler' ) &&
Tribe__Events__Pro__Recurrence__Scheduler::CRON_HOOK === $event->hook
) {
$event->schedule = 'hourly';
}
return $event;
}
add_filter( 'schedule_event' , 'tribe_alter_recurrence_rebuild_schedule', '10', 1 );
// Load any page on your site once, then remove or comment out the following line.
// This line will cause the cron to reschedule itself, if you do not remove it the
// cron will continually reschedule itself and never actually run.
wp_clear_scheduled_hook( Tribe__Events__Pro__Recurrence__Scheduler::CRON_HOOK );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment