wp_get_scheduled_event( string $hook, array $args = array(), int|null $timestamp = null ): object|false  Retrieve a scheduled event.   Description Retrieve the full event object for a given event, if no timestamp is specified the next scheduled event is returned.   Parameters   $hook string Required    Action hook of the event.    $args array Optional     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, so they should be the same as those used when originally scheduling the event.   Default: array()   $timestamp int|null Optional     Unix timestamp (UTC) of the event. If not specified, the next scheduled event is returned.   Default: null     Return object|false The event object. False if the event does not exist.   Source  File: wp-includes/cron.php. View all references  function wp_get_scheduled_event( $hook, $args = array(), $timestamp = null ) {
	/**
	 * 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.
	 *
	 * @since 5.1.0
	 *
	 * @param null|false|object $pre  Value to return instead. Default null to continue retrieving the event.
	 * @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.
	 */
	$pre = apply_filters( 'pre_get_scheduled_event', null, $hook, $args, $timestamp );
	if ( null !== $pre ) {
		return $pre;
	}

	if ( null !== $timestamp && ! is_numeric( $timestamp ) ) {
		return false;
	}

	$crons = _get_cron_array();
	if ( empty( $crons ) ) {
		return false;
	}

	$key = md5( serialize( $args ) );

	if ( ! $timestamp ) {
		// Get next event.
		$next = false;
		foreach ( $crons as $timestamp => $cron ) {
			if ( isset( $cron[ $hook ][ $key ] ) ) {
				$next = $timestamp;
				break;
			}
		}
		if ( ! $next ) {
			return false;
		}

		$timestamp = $next;
	} elseif ( ! isset( $crons[ $timestamp ][ $hook ][ $key ] ) ) {
		return false;
	}

	$event = (object) array(
		'hook'      => $hook,
		'timestamp' => $timestamp,
		'schedule'  => $crons[ $timestamp ][ $hook ][ $key ]['schedule'],
		'args'      => $args,
	);

	if ( isset( $crons[ $timestamp ][ $hook ][ $key ]['interval'] ) ) {
		$event->interval = $crons[ $timestamp ][ $hook ][ $key ]['interval'];
	}

	return $event;
}
   Hooks     apply_filters( 'pre_get_scheduled_event', null|false|object $pre, string $hook, array $args, int|null $timestamp )   
Filter to preflight or hijack retrieving a scheduled event.      Related  Uses    Uses Description      _get_cron_array() wp-includes/cron.php   Retrieve cron info array option.     apply_filters() wp-includes/plugin.php   Calls the callback functions that have been added to a filter hook.   
   Used By    Used By Description      wp_reschedule_event() wp-includes/cron.php   Reschedules a recurring event.     wp_next_scheduled() wp-includes/cron.php   Retrieve the next timestamp for an event.     wp_get_schedule() wp-includes/cron.php   Retrieve the recurrence schedule for an event.   
    Changelog    Version Description     5.1.0 Introduced.    

    
{'path': 'public/docs/wordpress/functions/wp_get_scheduled_event.html', 'source': 'DevDocs.IO'}