WP_Site_Health::maybe_create_scheduled_event()publicWP 5.4.0

Creates a weekly cron event, if one does not already exist.

Method of the class: WP_Site_Health{}

No Hooks.

Return

null. Nothing (null).

Usage

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

Changelog

Since 5.4.0 Introduced.

WP_Site_Health::maybe_create_scheduled_event() code WP 6.6.2

public function maybe_create_scheduled_event() {
	if ( ! wp_next_scheduled( 'wp_site_health_scheduled_check' ) && ! wp_installing() ) {
		wp_schedule_event( time() + DAY_IN_SECONDS, 'weekly', 'wp_site_health_scheduled_check' );
	}
}