wp_get_schedule

Advertisement

Summery Summery

Retrieve the recurrence schedule for an event.

Syntax Syntax

wp_get_schedule( string $hook, array $args = array() )

Parameters Parameters

$hook

(Required) Action hook to identify the event.

$args

(Optional) Arguments passed to the event's callback function.

Default value: array()

Return Return

(string|false) False, if no schedule. Schedule name on success.

Source Source

File: wp-includes/cron.php

function wp_get_schedule( $hook, $args = array() ) {
	$schedule = false;
	$event    = wp_get_scheduled_event( $hook, $args );

	if ( $event ) {
		$schedule = $event->schedule;
	}

	/**
	 * Filter the schedule for a hook.
	 *
	 * @since 5.1.0
	 *
	 * @param string|bool $schedule Schedule for the hook. False if not found.
	 * @param string      $hook     Action hook to execute when cron is run.
	 * @param array       $args     Optional. Arguments to pass to the hook's callback function.
	 */
	return apply_filters( 'get_schedule', $schedule, $hook, $args );
}

Advertisement

Changelog Changelog

Changelog
Version Description
5.1.0 'get_schedule' filter added.
2.1.0 Introduced.

See also See also

Advertisement

Leave a Reply