WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Site_Health::get_test_scheduled_events() public WP 5.2.0

Test if scheduled events run as intended.

If scheduled events are not running, this may indicate something with WP_Cron is not working as intended, or that there are orphaned events hanging around from older code.

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

Хуков нет.

Возвращает

Массив. The test results.

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

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

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

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

Код WP_Site_Health::get_test_scheduled_events() WP 5.5.1

wp-admin/includes/class-wp-site-health.php
<?php
public function get_test_scheduled_events() {
	$result = array(
		'label'       => __( 'Scheduled events are running' ),
		'status'      => 'good',
		'badge'       => array(
			'label' => __( 'Performance' ),
			'color' => 'blue',
		),
		'description' => sprintf(
			'<p>%s</p>',
			__( 'Scheduled events are what periodically looks for updates to plugins, themes and WordPress itself. It is also what makes sure scheduled posts are published on time. It may also be used by various plugins to make sure that planned actions are executed.' )
		),
		'actions'     => '',
		'test'        => 'scheduled_events',
	);

	$this->wp_schedule_test_init();

	if ( is_wp_error( $this->has_missed_cron() ) ) {
		$result['status'] = 'critical';

		$result['label'] = __( 'It was not possible to check your scheduled events' );

		$result['description'] = sprintf(
			'<p>%s</p>',
			sprintf(
				/* translators: %s: The error message returned while from the cron scheduler. */
				__( 'While trying to test your site&#8217;s scheduled events, the following error was returned: %s' ),
				$this->has_missed_cron()->get_error_message()
			)
		);
	} elseif ( $this->has_missed_cron() ) {
		$result['status'] = 'recommended';

		$result['label'] = __( 'A scheduled event has failed' );

		$result['description'] = sprintf(
			'<p>%s</p>',
			sprintf(
				/* translators: %s: The name of the failed cron event. */
				__( 'The scheduled event, %s, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ),
				$this->last_missed_cron
			)
		);
	} elseif ( $this->has_late_cron() ) {
		$result['status'] = 'recommended';

		$result['label'] = __( 'A scheduled event is late' );

		$result['description'] = sprintf(
			'<p>%s</p>',
			sprintf(
				/* translators: %s: The name of the late cron event. */
				__( 'The scheduled event, %s, is late to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.' ),
				$this->last_late_cron
			)
		);
	}

	return $result;
}