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

Filter to preflight or hijack retrieving a scheduled event.

Returning a non-null value will short-circuit the normal process, returning the filtered value instead.

Return false if the event does not exist, otherwise an event object should be returned.

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

add_filter( 'pre_get_scheduled_event', 'wp_kama_pre_get_scheduled_event_filter', 10, 4 );

/**
 * Function for `pre_get_scheduled_event` filter-hook.
 * 
 * @param null|false|object $pre       Value to return instead.
 * @param string            $hook      Action hook of the event.
 * @param array             $args      Array containing each separate argument to pass to the hook's callback function. Although not passed to a callback, these arguments are used to uniquely identify the event.
 * @param int|null          $timestamp Unix timestamp (UTC) of the event. Null to retrieve next scheduled event.
 *
 * @return null|false|object
 */
function wp_kama_pre_get_scheduled_event_filter( $pre, $hook, $args, $timestamp ){

	// filter...
	return $pre;
}
$pre(null|false|объект)
Value to return instead.
По умолчанию: null to continue retrieving the event
$hook(строка)
Action hook of the event.
$args(массив)
Array containing each separate argument to pass to the hook's callback function. Although not passed to a callback, these arguments are used to uniquely identify the event.
$timestamp(int|null)
Unix timestamp (UTC) of the event. Null to retrieve next scheduled event.

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

С версии 5.1.0 Введена.

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

wp_get_scheduled_event()
pre_get_scheduled_event
wp-includes/cron.php 756
$pre = apply_filters( 'pre_get_scheduled_event', null, $hook, $args, $timestamp );

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

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