Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I have created my plugin which will get input from form and below code will run
- //My Code to create events
- //hookname = gh_post
- wp_schedule_event( $next_run, 'fifteen_minutes', $hookname, $args );
- $cron_stop_time = $next_run + 180;
- $hookname_stop = $hookname.'_stop';
- wp_schedule_single_event( $cron_stop_time, $hookname_stop, $args);
- //I put this in functions.php
- add_action('gh_post_stop','gh_post_stop_callback');
- function gh_post_stop_callback($args)
- {
- update_option('touched_cron','stoped');
- while( false !== wp_unschedule_event( wp_next_scheduled( 'gh_post' ), 'gh_post' ) ) {}
- }
Add Comment
Please, Sign In to add comment