pre_unschedule_event хук-фильтрWP 5.1.0

Filter to override unscheduling of events.

Returning a non-null value will short-circuit the normal unscheduling process, causing the function to return the filtered value instead.

For plugins replacing wp-cron, return true if the event was successfully unscheduled, false or a WP_Error if not.

Использование

add_filter( 'pre_unschedule_event', 'wp_kama_pre_unschedule_event_filter', 10, 5 );

/**
 * Function for `pre_unschedule_event` filter-hook.
 * 
 * @param null|bool|WP_Error $pre       Value to return instead.
 * @param int                $timestamp Timestamp for when to run 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.
 * @param bool               $wp_error  Whether to return a WP_Error on failure.
 *
 * @return null|bool|WP_Error
 */
function wp_kama_pre_unschedule_event_filter( $pre, $timestamp, $hook, $args, $wp_error ){

	// filter...
	return $pre;
}
$pre(null|true|false|WP_Error)
Value to return instead.
По умолчанию: null to continue unscheduling the event
$timestamp(int)
Timestamp for when to run the event.
$hook(строка)
Action hook, the execution of which will be unscheduled.
$args(массив)
Arguments to pass to the hook's callback function.
$wp_error(true|false)
Whether to return a WP_Error on failure.

Список изменений

С версии 5.1.0 Введена.
С версии 5.7.0 The $wp_error parameter was added, and a WP_Error object can now be returned.

Где вызывается хук

wp_unschedule_event()
pre_unschedule_event
wp-includes/cron.php 493
$pre = apply_filters( 'pre_unschedule_event', null, $timestamp, $hook, $args, $wp_error );

Где используется хук в WordPress

Использование не найдено.