WP_Site_Health::get_cron_tasks()privateWP 5.2.0

Populates the list of cron events and store them to a class-wide variable.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->get_cron_tasks();

Список изменений

С версии 5.2.0 Введена.

Код WP_Site_Health::get_cron_tasks() WP 6.5.2

private function get_cron_tasks() {
	$cron_tasks = _get_cron_array();

	if ( empty( $cron_tasks ) ) {
		$this->crons = new WP_Error( 'no_tasks', __( 'No scheduled events exist on this site.' ) );
		return;
	}

	$this->crons = array();

	foreach ( $cron_tasks as $time => $cron ) {
		foreach ( $cron as $hook => $dings ) {
			foreach ( $dings as $sig => $data ) {

				$this->crons[ "$hook-$sig-$time" ] = (object) array(
					'hook'     => $hook,
					'time'     => $time,
					'sig'      => $sig,
					'args'     => $data['args'],
					'schedule' => $data['schedule'],
					'interval' => isset( $data['interval'] ) ? $data['interval'] : null,
				);

			}
		}
	}
}