wp_next_scheduled() WordPress Function

The wp_next_scheduled() function is used to get the next scheduled time for a task to run. It takes two parameters: the task (identified by a hook name) and any arguments that need to be passed to the task.

wp_next_scheduled( string $hook, array $args = array() ) #

Retrieve the next timestamp for an event.


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 value: array()


Top ↑

Return

(int|false) The Unix timestamp of the next time the event will occur. False if the event doesn't exist.


Top ↑

Source

File: wp-includes/cron.php

function wp_next_scheduled( $hook, $args = array() ) {
	$next_event = wp_get_scheduled_event( $hook, $args );
	if ( ! $next_event ) {
		return false;
	}

	return $next_event->timestamp;
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.