WC_Log_Handler_DB::delete_logs_before_timestamp()public staticWC 3.4.0

Delete all logs older than a defined timestamp.

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

Хуков нет.

Возвращает

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

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

$result = WC_Log_Handler_DB::delete_logs_before_timestamp( $timestamp );
$timestamp(int)
Timestamp to delete logs before.

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

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

Код WC_Log_Handler_DB::delete_logs_before_timestamp() WC 9.4.2

public static function delete_logs_before_timestamp( $timestamp = 0 ) {
	if ( ! $timestamp ) {
		return;
	}

	global $wpdb;

	$wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->prefix}woocommerce_log WHERE timestamp < %s",
			date( 'Y-m-d H:i:s', $timestamp )
		)
	);
}