WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp clear scheduled hook

Contents

Description

Un-schedules all previously-scheduled cron jobs using a particular hook name or a specific combination of hook name and arguments.

Usage

 <?php wp_clear_scheduled_hook$hook$args ); ?> 

Parameters

$hook
(string) (required) The name of an action hook to execute.
Default: None
$args
(array) (optional) Arguments to pass to the hook function(s)
Default: None

Return Value

No value is returned by this function.

Examples

Clear a scheduled event

// If you previously added for example
// wp_schedule_single_event( time() + 3600, 'my_new_event' );

wp_clear_scheduled_hook( 'my_new_event' );

// or this if you created something like
// wp_schedule_single_event( time() + 3600, 'my_new_event', array( 'some_arg' ) );

wp_clear_scheduled_hook( 'my_new_event', array( 'some_arg' ) );

Notes

If you created a scheduled job using a hook and arguments you cannot delete it by supplying only the hook. Similarly if you created a set of scheduled jobs that share a hook but have different arguments you cannot delete them using only the hook name, you have to delete them all individually using the hook name and arguments.

Change Log

Since: 2.1.0

Source File

wp_clear_scheduled_hook() is located in wp-includes/cron.php

Related

Cron Functions: wp_schedule_event(), wp_schedule_single_event(), wp_clear_scheduled_hook(), wp_next_scheduled(), wp_unschedule_event(), wp_get_schedule()

See also index of Function Reference and index of Template Tags.