Verifica se gli eventi programmati vengono eseguiti come previsto.

Descrizione

Se gli eventi programmati non vengono eseguiti, ciò può indicare che qualcosa in WP_Cron non funziona come previsto o che ci sono eventi orfani provenienti da codice più vecchio.

Ritorno

(array) I risultati del test.

Fonte

File: wp-admin/includes/class-wp-site-health.php

publicfunctionget_test_scheduled_events(){$result=array('label'=>__('Scheduled events are running'),'status'=>'good','badge'=>array('label'=>__('Performance'),'color'=>'blue',),'description'=>sprintf('

%s

'
,__('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('

%s

'
,sprintf(/* translators: %s: The error message returned while from the cron scheduler. */__('While trying to test your site’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('

%s

'
,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('

%s

'
,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;}

Correlato

Utilizzi

Usi Descrizione
wp-admin/includes/class-wp-site-health.php: WP_Site_Health::has_late_cron()

Controlla se le attività pianificate sono in ritardo.

wp-admin/includes/class-wp-site-health.php: WP_Site_Health::wp_schedule_test_init()

Avvia i casi di test della programmazione di WP_Cron.

wp-admin/includes/class-wp-site-health.php: WP_Site_Health::has_missed_cron()

Controlla se sono state perse delle attività programmate.

wp-includes/l10n.php: __()

Recupera la traduzione di $testo.

wp-includes/load.php: is_wp_error()

Controlla se la variabile data è un errore di WordPress.

Changelog

Versione Descrizione
5.2.0 Introdotto.