wphooks.info - pre_clear_scheduled_hook

pre_clear_scheduled_hook

(trunk - 5.1-alpha-44286)

*** New in trunk ***

The hook occurs in the following file:

wp-includes/cron.php:
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
	 * For plugins replacing wp-cron, return the number of events successfully
	 * unscheduled (zero if no events were registered with the hook) or false
	 * if unscheduling one or more events fails.
	 *
	 * @since 5.0.0
	 *
	 * @param null|array $pre  Value to return instead. Default null to continue unscheduling the event.
	 * @param string     $hook Action hook, the execution of which will be unscheduled.
	 * @param array      $args Arguments to pass to the hook's callback function.
	 */
	$pre = apply_filters( 'pre_clear_scheduled_hook', null, $hook, $args );
	if ( null !== $pre ) {
		return $pre;
	}

	// This logic duplicates wp_next_scheduled()
	// It's required due to a scenario where wp_unschedule_event() fails due to update_option() failing,
	// and, wp_next_scheduled() returns the same schedule in an infinite loop.
	$crons = _get_cron_array();
	if ( empty( $crons ) ) {