wp_unschedule_hook( string $hook )

Summary

Unschedules all events attached to the hook.


Description

Can be useful for plugins when deactivating to clean up the cron queue.


Parameters

$hook

(string) (Required) Action hook, the execution of which will be unscheduled.


Source

File: src/BigCommerce/Compatibility/wordpress-4-dot-9.php

	function wp_unschedule_hook( $hook ) {
		$crons = _get_cron_array();

		foreach( $crons as $timestamp => $args ) {
			unset( $crons[ $timestamp ][ $hook ] );

			if ( empty( $crons[ $timestamp ] ) ) {
				unset( $crons[ $timestamp ] );
			}
		}

		_set_cron_array( $crons );
	}

Changelog

Changelog
Version Description
4.9.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.