Created
November 10, 2016 22:38
-
-
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
This file contains hidden or 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
| <?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