PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Any code snippets to set a day range to auto clear old history?

šŸŽ„ Holiday Notice - Support Vacation šŸŽ„

ATTENTION: From December 28, 2025 to January 6, 2026 our support team will be on vacation.

Important information:

  • āŒ No ticket responses from December 28 to January 6
  • āœ… Support will resume on January 7, 2026
  • šŸ“ You can still submit tickets during vacation - they will be queued and answered starting January 7
  • āš ļø Urgent technical issues: Please check our documentation and codex first

šŸŽ… Season's Greetings! šŸŽ…

We want to thank all our amazing customers for your trust and support throughout 2025!
Merry Christmas and Happy New Year to you and your families! šŸŽ‰

We wish you:

  • šŸš€ Successful online stores
  • šŸ’° Growing sales
  • 😊 Happy customers
  • šŸŽÆ Achieved goals in 2026

Thank you for being with us! We appreciate every one of you and look forward to continuing our work together in the new year.

Rest, recharge, and see you in 2026!

Best regards,
PluginUs.Net Team

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi

Any code snippets to set a day range to auto clear old history for all users? e.g. delete history older than 30 days.

Million thanks

Hello

It is possible with MySQL and using external cron. You can use next code for your cron action:

global $wpdb;
$time = time()-30*24*60*60;
$wpdb->query("DELETE FROM woobe_history_bulk WHERE mod_date<{$time}");
$wpdb->query("DELETE FROM wp_woobe_history_bulk WHERE finished<{$time}");

 

 

Hi,

I have add below code in function.php and set the timer to 1 minute to test by using WP Control cron job BUT seems failed and nothing happen and no history clear.

add_action( 'test_new_cron', 'delete_old_woobe_hisroty_func' );
function delete_old_woobe_hisroty_func() {
global $wpdb;
$time = time()-60;
$wpdb->query("DELETE FROM woobe_history_bulk WHERE mod_date<{$time}");
$wpdb->query("DELETE FROM wp_woobe_history_bulk WHERE finished<{$time}");
}

https://wordpress.org/plugins/wp-crontrol/

Would you please help to guide me how to setup the cron job for auto clear history over specific time?

Million thanks

Hello

You can use external cron:

 

Hi,

I have added below code in function.php to test delete history over 1 day

function delete_old_woobe_hisroty_func() {
global $wpdb;
$time = time()-1*24*60*60;
$wpdb->query("DELETE FROM woobe_history_bulk WHERE mod_date<{$time}");
$wpdb->query("DELETE FROM wp_woobe_history_bulk WHERE finished<{$time}");
}

if(isset($_GET['delete_old_woobe_hisroty_func'])){
delete_old_woobe_hisroty_func();
exit;
}

and then I tried to visit https://mydomain.com/?delete_old_woobe_hisroty_func=1 in browser manually, however, still not work, no record deleted.

Please help

and hope you will consider to add feature that can set auto clear old history over specific time/days.

Many thanks

Hello

What plugin version number are you using?

Code Snippets Version 2.14.1
https://wordpress.org/plugins/code-snippets/
and
WP Crontrol Version 1.10.0
https://wordpress.org/plugins/wp-crontrol/

WordPress 5.8
WooCommerce 5.6.0

Million thanks

Sory!Ā  IĀ  meanĀ  versionĀ  ofĀ  BEAR/WOOBE plugin

BEAR - Bulk Editor and Products Manager Version 2.0.8.1

Thanks :)

Hello

Ok!Ā  Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png andĀ  wp-admin+FTP access - https://share.pluginus.net/image/i20210618130637.png I willĀ  checkĀ  this snippet