ACF\Site_Health
Site_Health::update_site_health_data
Stores debug data in the ACF site health option.
Метод класса: Site_Health{}
Хуков нет.
Возвращает
boolean.
Использование
$Site_Health = new Site_Health(); $Site_Health->update_site_health_data( $data ): bool;
- $data(массив)
- Data to update with (optional).
По умолчанию:array()
Список изменений
| С версии 6.3 | Введена. |
Код Site_Health::update_site_health_data() Site Health::update site health data ACF 6.8.11
public function update_site_health_data( array $data = array() ): bool {
if ( wp_doing_cron() ) {
// Bootstrap wp-admin, as WP_Cron doesn't do this for us.
require_once trailingslashit( ABSPATH ) . 'wp-admin/includes/admin.php';
}
$site_health = $this->get_site_health();
$values = ! empty( $data ) ? $data : $this->get_site_health_values();
$updated = array();
if ( ! empty( $values ) ) {
foreach ( $values as $key => $value ) {
$updated[ $key ] = $value['debug'] ?? $value['value'];
}
}
foreach ( $site_health as $key => $value ) {
// Preserve event_* keys for activation tracking.
if ( 'event_' === substr( $key, 0, 6 ) ) {
$updated[ $key ] = $value;
continue;
}
// Preserve AI usage data.
if ( 'ai_usage' === $key ) {
$updated[ $key ] = $value;
continue;
}
}
$this->maybe_log_first_registered_block( $site_health, $updated );
$updated['last_updated'] = time();
return $this->update_site_health( $updated );
}