WordPress at Your Fingertips
function is not described

WP_Site_Health::has_late_cron() public WP 5.3.0

Check if any scheduled tasks are late.

Returns a boolean value of true if a scheduled task is late and ends processing.

If the list of crons is an instance of WP_Error, returns the instance instead of a boolean value.

{} It's a method of the class: WP_Site_Health{}

No Hooks.

Return

true|false|WP_Error. True if a cron is late, false if not. WP_Error if the cron is set to that.

Usage

$WP_Site_Health = new WP_Site_Health();
$WP_Site_Health->has_late_cron();

Changelog

Since 5.3.0 Introduced.

Code of WP_Site_Health::has_late_cron() WP 5.8.2

public function has_late_cron() {
	if ( is_wp_error( $this->crons ) ) {
		return $this->crons;
	}

	foreach ( $this->crons as $id => $cron ) {
		$cron_offset = $cron->time - time();
		if (
			$cron_offset >= $this->timeout_missed_cron &&
			$cron_offset < $this->timeout_late_cron
		) {
			$this->last_late_cron = $cron->hook;
			return true;
		}
	}

	return false;
}