Advertisements

wp_unschedule_event

Definition:
function wp_unschedule_event( $timestamp, $hook, $args = array() {}

Unschedule a previously scheduled cron job.
The $timestamp and $hook parameters are required, so that the event can be identified.

Parameters

  • int $timestamp: Timestamp for when to run the event.
  • string $hook: Action hook, the execution of which will be unscheduled.
  • array $args: Arguments to pass to the hook’s callback function. Although not passed to a callback function, these arguments are used to uniquely identify the scheduled event, so they should be the same as those used when originally scheduling the event.

Source code

function wp_unschedule_event( $timestamp, $hook, $args = array() ) {

	$crons = _get_cron_array();

	$key = md5(serialize($args));

	unset( $crons[$timestamp][$hook][$key] );

	if ( empty($crons[$timestamp][$hook]) )

		unset( $crons[$timestamp][$hook] );

	if ( empty($crons[$timestamp]) )

		unset( $crons[$timestamp] );

	_set_cron_array( $crons );

}

4201

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: