Home Website TutorialsWordPress How to delete Action Scheduler in WooCommerce

How to delete Action Scheduler in WooCommerce

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

How to delete Action Scheduler in WooCommerce

In the process of using a WordPress website, sometimes you will encounter a sudden situation of full capacity while your website doesn’t have too much data. So why is the problem of full capacity?

If you use WooCommerce, you will encounter cases where the actionscheduler_actions và actionscheduler_logs tables take up too much space.

So what do these two tables mean and how to solve them, please continue reading.

How to delete Action Scheduler in WooCommerce

Action Scheduler is a component of the Woocommerce plugin to manage and track pre-scheduled actions. When a work task is triggered, it is implicitly processed in a fully automated manner.

The Action Scheduler will record a job log, which you can view in detail in the Scheduled Actions tab in the Status section of WooCommerce. In the database, data is stored in the wp_actionscheduler_actions and wp_actionscheduler_logs tables. Long time, the work tasks may become more and more, making the database cumbersome and slowing down your website.

For tasks that have been completed, failed or canceled, you should delete them to reduce the load on the database.

1. Delete in phpMyAdmin

At the phpMyadmin interface, click on Empty to empty this table.

WooCommerce Action Scheduler 1

2. Delete with mysql command

You access MySQL and then run the following commands in turn to delete.

Note: Each database will have a different prefix, you need to check the prefix you are using to correct it.

VD: wp_actionscheduler_actions (prefix is wp_)

AZDIGI Tutorial
DELETE FROM 'wp_actionscheduler_actions' WHERE 'status' = 'complete'
DELETE FROM 'wp_actionscheduler_actions' WHERE 'status' = 'canceled'
DELETE FROM 'wp_actionscheduler_actions' WHERE 'status' = 'failed'
    

3. add_filter in Theme’s functions

For performed tasks, the default is cleared for 30 days but you can change the setting to 7 days or 1 day.

You can add a filter in your theme for automatic deletion by opening the functions.php file at wp-content/themes/my-theme/functions.php. Then add the following at the bottom of the file.

AZDIGI Tutorial
add_filter( 'action_scheduler_retention_period', 'wp_action_scheduler_purge' );
/**
 * Change Action Scheduler default purge to 1 days
 */
function wpb_action_scheduler_purge() {
 return DAY_IN_SECONDS; #1 ngày
 #return WEEK_IN_SECONDS; #7 ngày
}
    

4. Change Storage Engine Database

Please change the table type from InnoDB to MyISAM to finish.

CleanShot 2022 04 03 at 17.55.36

So AZDIGI has completed the guide to remove Action Scheduler in WooCommerce.

Wishing you success!

If you need assistance, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign