WC_Log_Handler_DB::delete_logs_before_timestamp( integer $timestamp )

Delete all logs older than a defined timestamp.


Description Description


Parameters Parameters

$timestamp

(Required) Timestamp to delete logs before.


Top ↑

Source Source

File: includes/log-handlers/class-wc-log-handler-db.php

	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 )
			)
		);
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.