Created
March 17, 2014 16:23
-
-
Save codescribblr/9602614 to your computer and use it in GitHub Desktop.
Modifies cron schedule in Wordpress allowing you to add custom schedules.
From http://wp.smashingmagazine.com/2013/10/16/schedule-events-using-wordpress-cron/
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
| add_filter( 'cron_schedules', 'wi_add_weekly_schedule' ); | |
| function wi_add_weekly_schedule( $schedules ) { | |
| $schedules['weekly'] = array( | |
| 'interval' => 7 * 24 * 60 * 60, //7 days * 24 hours * 60 minutes * 60 seconds | |
| 'display' => __( 'Once Weekly', 'my-plugin-domain' ) | |
| ); | |
| /* | |
| You could add another schedule by creating an additional array element | |
| $schedules['biweekly'] = array( | |
| 'interval' => 7 * 24 * 60 * 60 * 2 | |
| 'display' => __( 'Every Other Week', 'my-plugin-domain' ) | |
| ); | |
| */ | |
| return $schedules; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment