WordPress at a glance
Home All Function Functions APIs Cron API

wp_next_scheduled() WP 1.0

Retrieve the next timestamp for an event.

Is the basis for: wp_schedule_single_event()
✈ 1 time = 0.001667s = very slow | 50000 times = 3.12s = fast | PHP 7.2.5, WP 4.9.8

No Hooks.

Return

false/Int. The Unix timestamp of the next time the event will occur. False if the event doesn't exist.

Usage

wp_next_scheduled( $hook, $args );
$hook(string) (required)
Action hook of the event.
$args(array)
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()

Code of wp next scheduled: wp-includes/cron.php WP 5.2

<?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;
}

Related Functions

From tag: cron (schedule)

No comments
    Hello, !     Log In . Register