Last active
December 15, 2015 07:19
-
-
Save LinzardMac/5222943 to your computer and use it in GitHub Desktop.
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
// Schedules an event | |
function fbp_create_schedule2() { | |
global $fbp_opts; | |
$recurrence = isset($fbp_opts['recurrence']) ? $fbp_opts['recurrence'] : 'hourly'; | |
$schedule = wp_get_schedule('fbp_statuses_to_posts'); | |
$author_id = isset($fbp_opts['author']) ? $fbp_opts['author'] : 0; | |
$author = get_user_by('id', $author_id); | |
// Clear the schedule if recurrence was changed | |
if($schedule != $recurrence) { | |
wp_clear_scheduled_hook('fbp_statuses_to_posts'); | |
} | |
if(!wp_next_scheduled('fbp_statuses_to_posts')) { | |
wp_schedule_event(time(), $recurrence, 'fbp_statuses_to_posts'); | |
} | |
### Not sure what these comments are for, but I'm sure you probably do ### | |
} | |
add_action('init', 'fbp_create_schedule2'); | |
function clear_cron_deactivate_fb(){ | |
wp_clear_scheduled_hook('fbp_statuses_to_posts'); | |
} | |
register_deactivation_hook(__FILE__, 'clear_cron_deactivate_fb'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment