WPSEO_Tracking::schedule_tracking_data_sending()publicYoast 1.0

Schedules a new sending of the tracking data after a WordPress core update.

Метод класса: WPSEO_Tracking{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPSEO_Tracking = new WPSEO_Tracking();
$WPSEO_Tracking->schedule_tracking_data_sending( $upgrader, $data );
$upgrader(true|false|WP_Upgrader)
WP_Upgrader instance or false. Depending on context, it might be a Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader. instance.
По умолчанию: false
$data(массив)
Array of update data.
По умолчанию: []

Код WPSEO_Tracking::schedule_tracking_data_sending() Yoast 23.5

public function schedule_tracking_data_sending( $upgrader = false, $data = [] ) {
	// Return if it's not a WordPress core update.
	if ( ! $upgrader || ! isset( $data['type'] ) || $data['type'] !== 'core' ) {
		return;
	}

	/*
	 * To uniquely identify the scheduled cron event, `wp_next_scheduled()`
	 * needs to receive the same arguments as those used when originally
	 * scheduling the event otherwise it will always return false.
	 */
	if ( ! wp_next_scheduled( 'wpseo_send_tracking_data_after_core_update', [ true ] ) ) {
		/*
		 * Schedule sending of data tracking 6 hours after a WordPress core
		 * update. Pass a `true` parameter for the callback `$force` argument.
		 */
		wp_schedule_single_event( ( time() + ( HOUR_IN_SECONDS * 6 ) ), 'wpseo_send_tracking_data_after_core_update', [ true ] );
	}
}