WordPress at a glance

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 scheduled event will occur.

Usage

wp_next_scheduled( $hook, $args );
$hook(string) (required)
Action hook to execute when event is run.
$args(array)
Arguments to pass to the hook's callback function.
Default: array()

Code of wp_next_scheduled: wp-includes/cron.php VER 4.9.8

<?php
function wp_next_scheduled( $hook, $args = array() ) {
	$crons = _get_cron_array();
	$key = md5(serialize($args));
	if ( empty($crons) )
		return false;
	foreach ( $crons as $timestamp => $cron ) {
		if ( isset( $cron[$hook][$key] ) )
			return $timestamp;
	}
	return false;
}

Related Functions

From tag: cron (schedule)

No comments
    Hello, !     Log In . Register